@wfrog/vc-ui 1.0.0
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 +95 -0
- package/dist/es/chunk/-EkpfdcW.mjs +1100 -0
- package/dist/es/chunk/8rLUmOVR.mjs +29 -0
- package/dist/es/chunk/B-rxnVJv.mjs +3 -0
- package/dist/es/chunk/BAGoDD49.mjs +36 -0
- package/dist/es/chunk/BAtns-Mc.mjs +96 -0
- package/dist/es/chunk/BJS5Pdfp.mjs +55 -0
- package/dist/es/chunk/BMzd-IS6.mjs +900 -0
- package/dist/es/chunk/BWcCXRRK.mjs +229 -0
- package/dist/es/chunk/BX-Ogf7p.mjs +3743 -0
- package/dist/es/chunk/B_tU9Nax.mjs +49 -0
- package/dist/es/chunk/BdDihk0t.mjs +3420 -0
- package/dist/es/chunk/C2LgraHx.mjs +489 -0
- package/dist/es/chunk/C5hWsUfD.mjs +64 -0
- package/dist/es/chunk/C7iSSBUr.mjs +303 -0
- package/dist/es/chunk/CD98REcR.mjs +666 -0
- package/dist/es/chunk/CEClY-_T.mjs +445 -0
- package/dist/es/chunk/CEm0brzD.mjs +35 -0
- package/dist/es/chunk/CMABHk8B.mjs +1942 -0
- package/dist/es/chunk/CS4VKsqy.mjs +19 -0
- package/dist/es/chunk/CVlj9F0I.mjs +291 -0
- package/dist/es/chunk/CZ4ggqDE.mjs +140 -0
- package/dist/es/chunk/CaTfZePA.mjs +533 -0
- package/dist/es/chunk/Ce9ApjrT.mjs +201 -0
- package/dist/es/chunk/ClZGuAIb.mjs +10 -0
- package/dist/es/chunk/Coex0GxM.mjs +450 -0
- package/dist/es/chunk/Ct6q2FXg.mjs +5 -0
- package/dist/es/chunk/CyxEcbcy.mjs +29 -0
- package/dist/es/chunk/D389hx_T.mjs +35 -0
- package/dist/es/chunk/D3DXeVfC.mjs +1171 -0
- package/dist/es/chunk/D3uV7vm-.mjs +45 -0
- package/dist/es/chunk/D5259bwd.mjs +50 -0
- package/dist/es/chunk/DMHNh_tw.mjs +49 -0
- package/dist/es/chunk/DVNTpOBR.mjs +4 -0
- package/dist/es/chunk/DZACQ9LT.mjs +95 -0
- package/dist/es/chunk/De_EXLIy.mjs +22 -0
- package/dist/es/chunk/Dh4jaUSg.mjs +89 -0
- package/dist/es/chunk/DhhdKtyu.mjs +439 -0
- package/dist/es/chunk/DqUIKX7f.mjs +2039 -0
- package/dist/es/chunk/Dqz1zvKN.mjs +59 -0
- package/dist/es/chunk/Dvi7RsXg.mjs +727 -0
- package/dist/es/chunk/DyDMGLoF.mjs +123 -0
- package/dist/es/chunk/E_WRn0OP.mjs +449 -0
- package/dist/es/chunk/Fo0dZYnz.mjs +128 -0
- package/dist/es/chunk/HSv8BL8o.mjs +72 -0
- package/dist/es/chunk/JCIyOUEY.mjs +105 -0
- package/dist/es/chunk/O-uhUKF4.mjs +43 -0
- package/dist/es/chunk/Spa-JKB4.mjs +1046 -0
- package/dist/es/chunk/VAdRxe-1.mjs +16 -0
- package/dist/es/chunk/VCrtRnxt.mjs +1477 -0
- package/dist/es/chunk/ViP2SEY4.mjs +211 -0
- package/dist/es/chunk/aibQ9WSZ.mjs +249 -0
- package/dist/es/chunk/nWBcrYxV.mjs +690 -0
- package/dist/es/chunk/pcqpp-6-.mjs +9 -0
- package/dist/es/chunk/qY9OvNHY.mjs +283 -0
- package/dist/es/chunk/su2Zrql0.mjs +53 -0
- package/dist/es/chunk/zfg5SOj1.mjs +138 -0
- package/dist/es/components/awesome-icon/awesome-icon.d.ts +6 -0
- package/dist/es/components/awesome-icon/awesome-icon.mjs +41 -0
- package/dist/es/components/awesome-icon/awesome-icon.vue.d.ts +5 -0
- package/dist/es/components/awesome-icon/index.d.ts +4 -0
- package/dist/es/components/awesome-icon/index.mjs +6 -0
- package/dist/es/components/backbottom/backbottom.d.ts +7 -0
- package/dist/es/components/backbottom/backbottom.mjs +172 -0
- package/dist/es/components/backbottom/backbottom.vue.d.ts +7 -0
- package/dist/es/components/backbottom/components/child.vue.d.ts +30 -0
- package/dist/es/components/backbottom/index.d.ts +4 -0
- package/dist/es/components/backbottom/index.mjs +6 -0
- package/dist/es/components/button/button.d.ts +18 -0
- package/dist/es/components/button/button.mjs +313 -0
- package/dist/es/components/button/button.vue.d.ts +33 -0
- package/dist/es/components/button/index.css +9 -0
- package/dist/es/components/button/index.d.ts +4 -0
- package/dist/es/components/button/index.mjs +6 -0
- package/dist/es/components/cdn-tag.vue.d.ts +5 -0
- package/dist/es/components/chat-container/chat-container.d.ts +9 -0
- package/dist/es/components/chat-container/chat-container.mjs +77 -0
- package/dist/es/components/chat-container/chat-container.vue.d.ts +29 -0
- package/dist/es/components/chat-container/index.css +9 -0
- package/dist/es/components/chat-container/index.d.ts +4 -0
- package/dist/es/components/chat-container/index.mjs +6 -0
- package/dist/es/components/choice/choice.d.ts +6 -0
- package/dist/es/components/choice/choice.mjs +53 -0
- package/dist/es/components/choice/choice.vue.d.ts +5 -0
- package/dist/es/components/choice/index.css +7 -0
- package/dist/es/components/choice/index.d.ts +4 -0
- package/dist/es/components/choice/index.mjs +6 -0
- package/dist/es/components/choice-boolean/choice-boolean.d.ts +5 -0
- package/dist/es/components/choice-boolean/choice-boolean.mjs +32 -0
- package/dist/es/components/choice-boolean/choice-boolean.vue.d.ts +10 -0
- package/dist/es/components/choice-boolean/index.d.ts +4 -0
- package/dist/es/components/choice-boolean/index.mjs +6 -0
- package/dist/es/components/config-provider/config-provider.d.ts +16 -0
- package/dist/es/components/config-provider/config-provider.mjs +29 -0
- package/dist/es/components/config-provider/config-provider.vue.d.ts +18 -0
- package/dist/es/components/config-provider/config-provider2.mjs +6 -0
- package/dist/es/components/config-provider/index.d.ts +4 -0
- package/dist/es/components/config-provider/index.mjs +6 -0
- package/dist/es/components/cropper/cropper.d.ts +12 -0
- package/dist/es/components/cropper/cropper.mjs +333 -0
- package/dist/es/components/cropper/cropper.vue.d.ts +32 -0
- package/dist/es/components/cropper/index.css +4 -0
- package/dist/es/components/cropper/index.d.ts +4 -0
- package/dist/es/components/cropper/index.mjs +6 -0
- package/dist/es/components/currency/currency.d.ts +21 -0
- package/dist/es/components/currency/currency.mjs +185 -0
- package/dist/es/components/currency/currency.vue.d.ts +14 -0
- package/dist/es/components/currency/index.css +8 -0
- package/dist/es/components/currency/index.d.ts +4 -0
- package/dist/es/components/currency/index.mjs +6 -0
- package/dist/es/components/daterange-picker/daterange-picker.d.ts +6 -0
- package/dist/es/components/daterange-picker/daterange-picker.mjs +5550 -0
- package/dist/es/components/daterange-picker/daterange-picker.vue.d.ts +13 -0
- package/dist/es/components/daterange-picker/index.d.ts +4 -0
- package/dist/es/components/daterange-picker/index.mjs +6 -0
- package/dist/es/components/dialog/dialog.d.ts +13 -0
- package/dist/es/components/dialog/dialog.mjs +537 -0
- package/dist/es/components/dialog/dialog.vue.d.ts +38 -0
- package/dist/es/components/dialog/index.css +87 -0
- package/dist/es/components/dialog/index.d.ts +4 -0
- package/dist/es/components/dialog/index.mjs +6 -0
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.d.ts +33 -0
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +412 -0
- package/dist/es/components/dialog-camera-upload/dialog-camera-upload.vue.d.ts +23 -0
- package/dist/es/components/dialog-camera-upload/index.css +66 -0
- package/dist/es/components/dialog-camera-upload/index.d.ts +4 -0
- package/dist/es/components/dialog-camera-upload/index.mjs +6 -0
- package/dist/es/components/dialog-map-point/dialog-map-point.d.ts +9 -0
- package/dist/es/components/dialog-map-point/dialog-map-point.mjs +183 -0
- package/dist/es/components/dialog-map-point/dialog-map-point.vue.d.ts +22 -0
- package/dist/es/components/dialog-map-point/index.css +11 -0
- package/dist/es/components/dialog-map-point/index.d.ts +4 -0
- package/dist/es/components/dialog-map-point/index.mjs +6 -0
- package/dist/es/components/dialog-upload-images/dialog-upload-images.d.ts +16 -0
- package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +1391 -0
- package/dist/es/components/dialog-upload-images/dialog-upload-images.vue.d.ts +19 -0
- package/dist/es/components/dialog-upload-images/index.css +62 -0
- package/dist/es/components/dialog-upload-images/index.d.ts +4 -0
- package/dist/es/components/dialog-upload-images/index.mjs +6 -0
- package/dist/es/components/document.vue.d.ts +14 -0
- package/dist/es/components/drawer/drawer.d.ts +7 -0
- package/dist/es/components/drawer/drawer.mjs +412 -0
- package/dist/es/components/drawer/drawer.vue.d.ts +31 -0
- package/dist/es/components/drawer/index.css +56 -0
- package/dist/es/components/drawer/index.d.ts +4 -0
- package/dist/es/components/drawer/index.mjs +6 -0
- package/dist/es/components/easy-pagination/easy-pagination.d.ts +8 -0
- package/dist/es/components/easy-pagination/easy-pagination.mjs +74 -0
- package/dist/es/components/easy-pagination/easy-pagination.vue.d.ts +19 -0
- package/dist/es/components/easy-pagination/index.css +10 -0
- package/dist/es/components/easy-pagination/index.d.ts +4 -0
- package/dist/es/components/easy-pagination/index.mjs +6 -0
- package/dist/es/components/el-icon/el-icon.d.ts +6 -0
- package/dist/es/components/el-icon/el-icon.mjs +46 -0
- package/dist/es/components/el-icon/el-icon.vue.d.ts +6 -0
- package/dist/es/components/el-icon/index.css +7 -0
- package/dist/es/components/el-icon/index.d.ts +4 -0
- package/dist/es/components/el-icon/index.mjs +6 -0
- package/dist/es/components/example-wrapper.vue.d.ts +19 -0
- package/dist/es/components/flag/flag.mjs +44 -0
- package/dist/es/components/flag/flag.vue.d.ts +5 -0
- package/dist/es/components/flag/flags.d.ts +8 -0
- package/dist/es/components/flag/index.d.ts +4 -0
- package/dist/es/components/flag/index.mjs +6 -0
- package/dist/es/components/icon/icon.d.ts +6 -0
- package/dist/es/components/icon/icon.mjs +54 -0
- package/dist/es/components/icon/icon.vue.d.ts +3 -0
- package/dist/es/components/icon/icon2.mjs +27 -0
- package/dist/es/components/icon/index.css +9 -0
- package/dist/es/components/icon/index.d.ts +4 -0
- package/dist/es/components/icon/index.mjs +6 -0
- package/dist/es/components/image/image.d.ts +16 -0
- package/dist/es/components/image/image.mjs +167 -0
- package/dist/es/components/image/image.vue.d.ts +206 -0
- package/dist/es/components/image/index.css +20 -0
- package/dist/es/components/image/index.d.ts +4 -0
- package/dist/es/components/image/index.mjs +6 -0
- package/dist/es/components/input/index.css +9 -0
- package/dist/es/components/input/index.d.ts +4 -0
- package/dist/es/components/input/index.mjs +6 -0
- package/dist/es/components/input/input.d.ts +4 -0
- package/dist/es/components/input/input.mjs +85 -0
- package/dist/es/components/input/input.vue.d.ts +1232 -0
- package/dist/es/components/input-number/index.css +24 -0
- package/dist/es/components/input-number/index.d.ts +4 -0
- package/dist/es/components/input-number/index.mjs +6 -0
- package/dist/es/components/input-number/input-number.d.ts +8 -0
- package/dist/es/components/input-number/input-number.mjs +137 -0
- package/dist/es/components/input-number/input-number.vue.d.ts +35 -0
- package/dist/es/components/pca-picker/components/c.vue.d.ts +123 -0
- package/dist/es/components/pca-picker/components/elevator-item.vue.d.ts +7 -0
- package/dist/es/components/pca-picker/components/filter.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/history.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/hot.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/p.vue.d.ts +2 -0
- package/dist/es/components/pca-picker/components/pca.vue.d.ts +9 -0
- package/dist/es/components/pca-picker/index.css +107 -0
- package/dist/es/components/pca-picker/index.d.ts +4 -0
- package/dist/es/components/pca-picker/index.mjs +6 -0
- package/dist/es/components/pca-picker/pca-picker.d.ts +78 -0
- package/dist/es/components/pca-picker/pca-picker.mjs +1667 -0
- package/dist/es/components/pca-picker/pca-picker.vue.d.ts +583 -0
- package/dist/es/components/qr-code/index.d.ts +4 -0
- package/dist/es/components/qr-code/index.mjs +6 -0
- package/dist/es/components/qr-code/qr-code.d.ts +9 -0
- package/dist/es/components/qr-code/qr-code.mjs +69 -0
- package/dist/es/components/qr-code/qr-code.vue.d.ts +13 -0
- package/dist/es/components/screenfull/index.css +14 -0
- package/dist/es/components/screenfull/index.d.ts +4 -0
- package/dist/es/components/screenfull/index.mjs +6 -0
- package/dist/es/components/screenfull/screenfull.d.ts +4 -0
- package/dist/es/components/screenfull/screenfull.mjs +91 -0
- package/dist/es/components/screenfull/screenfull.vue.d.ts +20 -0
- package/dist/es/components/select/index.css +9 -0
- package/dist/es/components/select/index.d.ts +4 -0
- package/dist/es/components/select/index.mjs +6 -0
- package/dist/es/components/select/select.d.ts +6 -0
- package/dist/es/components/select/select.mjs +63 -0
- package/dist/es/components/select/select.vue.d.ts +6 -0
- package/dist/es/components/single-player/index.css +45 -0
- package/dist/es/components/single-player/index.d.ts +4 -0
- package/dist/es/components/single-player/index.mjs +6 -0
- package/dist/es/components/single-player/single-player.d.ts +4 -0
- package/dist/es/components/single-player/single-player.mjs +1172 -0
- package/dist/es/components/single-player/single-player.vue.d.ts +13 -0
- package/dist/es/components/svg-icon/index.css +9 -0
- package/dist/es/components/svg-icon/index.d.ts +4 -0
- package/dist/es/components/svg-icon/index.mjs +6 -0
- package/dist/es/components/svg-icon/svg-icon.d.ts +5 -0
- package/dist/es/components/svg-icon/svg-icon.mjs +46 -0
- package/dist/es/components/svg-icon/svg-icon.vue.d.ts +18 -0
- package/dist/es/components/switch/index.css +15 -0
- package/dist/es/components/switch/index.d.ts +4 -0
- package/dist/es/components/switch/index.mjs +6 -0
- package/dist/es/components/switch/switch.d.ts +9 -0
- package/dist/es/components/switch/switch.mjs +82 -0
- package/dist/es/components/switch/switch.vue.d.ts +14 -0
- package/dist/es/components/sync-scroll-container/index.css +82 -0
- package/dist/es/components/sync-scroll-container/index.d.ts +4 -0
- package/dist/es/components/sync-scroll-container/index.mjs +6 -0
- package/dist/es/components/sync-scroll-container/sync-scroll-container.d.ts +6 -0
- package/dist/es/components/sync-scroll-container/sync-scroll-container.mjs +157 -0
- package/dist/es/components/sync-scroll-container/sync-scroll-container.vue.d.ts +36 -0
- package/dist/es/components/tags/index.css +17 -0
- package/dist/es/components/tags/index.d.ts +4 -0
- package/dist/es/components/tags/index.mjs +6 -0
- package/dist/es/components/tags/tags.d.ts +9 -0
- package/dist/es/components/tags/tags.mjs +296 -0
- package/dist/es/components/tags/tags.vue.d.ts +20 -0
- package/dist/es/components/text-ellipsis/index.css +15 -0
- package/dist/es/components/text-ellipsis/index.d.ts +4 -0
- package/dist/es/components/text-ellipsis/index.mjs +6 -0
- package/dist/es/components/text-ellipsis/text-ellipsis.d.ts +12 -0
- package/dist/es/components/text-ellipsis/text-ellipsis.mjs +137 -0
- package/dist/es/components/text-ellipsis/text-ellipsis.vue.d.ts +41 -0
- package/dist/es/components/thousand-input/index.css +4 -0
- package/dist/es/components/thousand-input/index.d.ts +4 -0
- package/dist/es/components/thousand-input/index.mjs +6 -0
- package/dist/es/components/thousand-input/thousand-input.d.ts +11 -0
- package/dist/es/components/thousand-input/thousand-input.mjs +159 -0
- package/dist/es/components/thousand-input/thousand-input.vue.d.ts +2558 -0
- package/dist/es/components/tinymce/config.d.ts +25 -0
- package/dist/es/components/tinymce/index.css +9 -0
- package/dist/es/components/tinymce/index.d.ts +4 -0
- package/dist/es/components/tinymce/index.mjs +6 -0
- package/dist/es/components/tinymce/tinymce.d.ts +9 -0
- package/dist/es/components/tinymce/tinymce.mjs +176 -0
- package/dist/es/components/tinymce/tinymce.vue.d.ts +20 -0
- package/dist/es/components/tree-picker/components/popover-cascader.d.ts +8 -0
- package/dist/es/components/tree-picker/components/popover-cascader.vue.d.ts +1361 -0
- package/dist/es/components/tree-picker/docs/data.d.ts +2 -0
- package/dist/es/components/tree-picker/index.css +41 -0
- package/dist/es/components/tree-picker/index.d.ts +4 -0
- package/dist/es/components/tree-picker/index.mjs +6 -0
- package/dist/es/components/tree-picker/popover-cascader.css +23 -0
- package/dist/es/components/tree-picker/tree-picker.d.ts +14 -0
- package/dist/es/components/tree-picker/tree-picker.mjs +173 -0
- package/dist/es/components/tree-picker/tree-picker.vue.d.ts +575 -0
- package/dist/es/components/upload-file/index.css +30 -0
- package/dist/es/components/upload-file/index.d.ts +4 -0
- package/dist/es/components/upload-file/index.mjs +6 -0
- package/dist/es/components/upload-file/upload-file.d.ts +39 -0
- package/dist/es/components/upload-file/upload-file.mjs +202 -0
- package/dist/es/components/upload-file/upload-file.vue.d.ts +30 -0
- package/dist/es/directives/cleave/index.d.ts +3 -0
- package/dist/es/directives/focus/index.d.ts +4 -0
- package/dist/es/directives/index.d.ts +3 -0
- package/dist/es/directives/thousand/index.d.ts +3 -0
- package/dist/es/index.d.ts +42 -0
- package/dist/es/index.mjs +122 -0
- package/dist/es/use/useSmallScreen/index.d.ts +4 -0
- package/dist/es/use/useSmallScreen/index.mjs +10 -0
- package/dist/es/use/useStore/index.d.ts +3 -0
- package/dist/es/use/useStore/index.mjs +22 -0
- package/dist/es/utils/index.d.ts +6 -0
- package/dist/es/utils/resolver.d.ts +3 -0
- package/dist/es/utils/resolver.mjs +24 -0
- package/dist/es/utils/typescript.d.ts +6 -0
- package/dist/global.d.ts +42 -0
- package/dist/index.css +869 -0
- package/package.json +58 -0
|
@@ -0,0 +1,900 @@
|
|
|
1
|
+
import { defineComponent, markRaw, ref, effectScope, computed, shallowRef, watch, nextTick, onMounted, createBlock, openBlock, unref, withCtx, createVNode, Transition, createElementVNode, normalizeStyle, normalizeClass, createCommentVNode, createElementBlock, renderSlot, withModifiers, Fragment, createTextVNode, toDisplayString, resolveDynamicComponent, useAttrs, mergeProps, createSlots, normalizeProps, guardReactiveProps } from 'vue';
|
|
2
|
+
import { c as useEventListener, d as useIntersectionObserver } from './CEClY-_T.mjs';
|
|
3
|
+
import { b as ElTeleport, d as ElFocusTrap } from './DqUIKX7f.mjs';
|
|
4
|
+
import { E as ElIcon } from './DMHNh_tw.mjs';
|
|
5
|
+
import { ScaleToOriginal, FullScreen, Close, ArrowLeft, ArrowRight, ZoomOut, ZoomIn, RefreshLeft, RefreshRight } from '@element-plus/icons-vue';
|
|
6
|
+
import { f as isNumber, c as buildProps, d as definePropType, u as useNamespace, m as clamp, n as fromPairs, o as isClient, i as isArray, p as isElement, h as isString, q as isWindow, r as useThrottleFn } from './E_WRn0OP.mjs';
|
|
7
|
+
import { m as mutable } from './B-rxnVJv.mjs';
|
|
8
|
+
import { _ as _export_sfc, w as withInstall } from './D389hx_T.mjs';
|
|
9
|
+
import { u as useLocale } from './aibQ9WSZ.mjs';
|
|
10
|
+
import { u as useZIndex } from './CEm0brzD.mjs';
|
|
11
|
+
import { u as useLockscreen } from './D3uV7vm-.mjs';
|
|
12
|
+
import { g as getEventCode, E as EVENT_CODE } from './BJS5Pdfp.mjs';
|
|
13
|
+
import { k as keysOf } from './DVNTpOBR.mjs';
|
|
14
|
+
import { d as debounce } from './ViP2SEY4.mjs';
|
|
15
|
+
import { i as isObject } from './Spa-JKB4.mjs';
|
|
16
|
+
import { u as useAttrs$1 } from './De_EXLIy.mjs';
|
|
17
|
+
import { g as getScrollContainer } from './DyDMGLoF.mjs';
|
|
18
|
+
|
|
19
|
+
/** Error message constants. */
|
|
20
|
+
var FUNC_ERROR_TEXT = 'Expected a function';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Creates a throttled function that only invokes `func` at most once per
|
|
24
|
+
* every `wait` milliseconds. The throttled function comes with a `cancel`
|
|
25
|
+
* method to cancel delayed `func` invocations and a `flush` method to
|
|
26
|
+
* immediately invoke them. Provide `options` to indicate whether `func`
|
|
27
|
+
* should be invoked on the leading and/or trailing edge of the `wait`
|
|
28
|
+
* timeout. The `func` is invoked with the last arguments provided to the
|
|
29
|
+
* throttled function. Subsequent calls to the throttled function return the
|
|
30
|
+
* result of the last `func` invocation.
|
|
31
|
+
*
|
|
32
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
33
|
+
* invoked on the trailing edge of the timeout only if the throttled function
|
|
34
|
+
* is invoked more than once during the `wait` timeout.
|
|
35
|
+
*
|
|
36
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
37
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
38
|
+
*
|
|
39
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
40
|
+
* for details over the differences between `_.throttle` and `_.debounce`.
|
|
41
|
+
*
|
|
42
|
+
* @static
|
|
43
|
+
* @memberOf _
|
|
44
|
+
* @since 0.1.0
|
|
45
|
+
* @category Function
|
|
46
|
+
* @param {Function} func The function to throttle.
|
|
47
|
+
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
|
|
48
|
+
* @param {Object} [options={}] The options object.
|
|
49
|
+
* @param {boolean} [options.leading=true]
|
|
50
|
+
* Specify invoking on the leading edge of the timeout.
|
|
51
|
+
* @param {boolean} [options.trailing=true]
|
|
52
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
53
|
+
* @returns {Function} Returns the new throttled function.
|
|
54
|
+
* @example
|
|
55
|
+
*
|
|
56
|
+
* // Avoid excessively updating the position while scrolling.
|
|
57
|
+
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
|
|
58
|
+
*
|
|
59
|
+
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
|
|
60
|
+
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
|
|
61
|
+
* jQuery(element).on('click', throttled);
|
|
62
|
+
*
|
|
63
|
+
* // Cancel the trailing throttled invocation.
|
|
64
|
+
* jQuery(window).on('popstate', throttled.cancel);
|
|
65
|
+
*/
|
|
66
|
+
function throttle(func, wait, options) {
|
|
67
|
+
var leading = true,
|
|
68
|
+
trailing = true;
|
|
69
|
+
|
|
70
|
+
if (typeof func != 'function') {
|
|
71
|
+
throw new TypeError(FUNC_ERROR_TEXT);
|
|
72
|
+
}
|
|
73
|
+
if (isObject(options)) {
|
|
74
|
+
leading = 'leading' in options ? !!options.leading : leading;
|
|
75
|
+
trailing = 'trailing' in options ? !!options.trailing : trailing;
|
|
76
|
+
}
|
|
77
|
+
return debounce(func, wait, {
|
|
78
|
+
'leading': leading,
|
|
79
|
+
'maxWait': wait,
|
|
80
|
+
'trailing': trailing
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const imageViewerProps = buildProps({
|
|
85
|
+
urlList: {
|
|
86
|
+
type: definePropType(Array),
|
|
87
|
+
default: () => mutable([])
|
|
88
|
+
},
|
|
89
|
+
zIndex: {
|
|
90
|
+
type: Number
|
|
91
|
+
},
|
|
92
|
+
initialIndex: {
|
|
93
|
+
type: Number,
|
|
94
|
+
default: 0
|
|
95
|
+
},
|
|
96
|
+
infinite: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: true
|
|
99
|
+
},
|
|
100
|
+
hideOnClickModal: Boolean,
|
|
101
|
+
teleported: Boolean,
|
|
102
|
+
closeOnPressEscape: {
|
|
103
|
+
type: Boolean,
|
|
104
|
+
default: true
|
|
105
|
+
},
|
|
106
|
+
zoomRate: {
|
|
107
|
+
type: Number,
|
|
108
|
+
default: 1.2
|
|
109
|
+
},
|
|
110
|
+
scale: {
|
|
111
|
+
type: Number,
|
|
112
|
+
default: 1
|
|
113
|
+
},
|
|
114
|
+
minScale: {
|
|
115
|
+
type: Number,
|
|
116
|
+
default: 0.2
|
|
117
|
+
},
|
|
118
|
+
maxScale: {
|
|
119
|
+
type: Number,
|
|
120
|
+
default: 7
|
|
121
|
+
},
|
|
122
|
+
showProgress: Boolean,
|
|
123
|
+
crossorigin: {
|
|
124
|
+
type: definePropType(String)
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
const imageViewerEmits = {
|
|
128
|
+
close: () => true,
|
|
129
|
+
error: (evt) => evt instanceof Event,
|
|
130
|
+
switch: (index) => isNumber(index),
|
|
131
|
+
rotate: (deg) => isNumber(deg)
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
const __default__$1 = defineComponent({
|
|
135
|
+
name: "ElImageViewer"
|
|
136
|
+
});
|
|
137
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
138
|
+
...__default__$1,
|
|
139
|
+
props: imageViewerProps,
|
|
140
|
+
emits: imageViewerEmits,
|
|
141
|
+
setup(__props, { expose, emit }) {
|
|
142
|
+
var _a;
|
|
143
|
+
const props = __props;
|
|
144
|
+
const modes = {
|
|
145
|
+
CONTAIN: {
|
|
146
|
+
name: "contain",
|
|
147
|
+
icon: markRaw(FullScreen)
|
|
148
|
+
},
|
|
149
|
+
ORIGINAL: {
|
|
150
|
+
name: "original",
|
|
151
|
+
icon: markRaw(ScaleToOriginal)
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
let stopWheelListener;
|
|
155
|
+
const { t } = useLocale();
|
|
156
|
+
const ns = useNamespace("image-viewer");
|
|
157
|
+
const { nextZIndex } = useZIndex();
|
|
158
|
+
const wrapper = ref();
|
|
159
|
+
const imgRef = ref();
|
|
160
|
+
const scopeEventListener = effectScope();
|
|
161
|
+
const scaleClamped = computed(() => {
|
|
162
|
+
const { scale, minScale, maxScale } = props;
|
|
163
|
+
return clamp(scale, minScale, maxScale);
|
|
164
|
+
});
|
|
165
|
+
const loading = ref(true);
|
|
166
|
+
const loadError = ref(false);
|
|
167
|
+
const visible = ref(false);
|
|
168
|
+
const activeIndex = ref(props.initialIndex);
|
|
169
|
+
const mode = shallowRef(modes.CONTAIN);
|
|
170
|
+
const transform = ref({
|
|
171
|
+
scale: scaleClamped.value,
|
|
172
|
+
deg: 0,
|
|
173
|
+
offsetX: 0,
|
|
174
|
+
offsetY: 0,
|
|
175
|
+
enableTransition: false
|
|
176
|
+
});
|
|
177
|
+
const zIndex = ref((_a = props.zIndex) != null ? _a : nextZIndex());
|
|
178
|
+
useLockscreen(visible, { ns });
|
|
179
|
+
const isSingle = computed(() => {
|
|
180
|
+
const { urlList } = props;
|
|
181
|
+
return urlList.length <= 1;
|
|
182
|
+
});
|
|
183
|
+
const isFirst = computed(() => activeIndex.value === 0);
|
|
184
|
+
const isLast = computed(() => activeIndex.value === props.urlList.length - 1);
|
|
185
|
+
const currentImg = computed(() => props.urlList[activeIndex.value]);
|
|
186
|
+
const arrowPrevKls = computed(() => [
|
|
187
|
+
ns.e("btn"),
|
|
188
|
+
ns.e("prev"),
|
|
189
|
+
ns.is("disabled", !props.infinite && isFirst.value)
|
|
190
|
+
]);
|
|
191
|
+
const arrowNextKls = computed(() => [
|
|
192
|
+
ns.e("btn"),
|
|
193
|
+
ns.e("next"),
|
|
194
|
+
ns.is("disabled", !props.infinite && isLast.value)
|
|
195
|
+
]);
|
|
196
|
+
const imgStyle = computed(() => {
|
|
197
|
+
const { scale, deg, offsetX, offsetY, enableTransition } = transform.value;
|
|
198
|
+
let translateX = offsetX / scale;
|
|
199
|
+
let translateY = offsetY / scale;
|
|
200
|
+
const radian = deg * Math.PI / 180;
|
|
201
|
+
const cosRadian = Math.cos(radian);
|
|
202
|
+
const sinRadian = Math.sin(radian);
|
|
203
|
+
translateX = translateX * cosRadian + translateY * sinRadian;
|
|
204
|
+
translateY = translateY * cosRadian - offsetX / scale * sinRadian;
|
|
205
|
+
const style = {
|
|
206
|
+
transform: `scale(${scale}) rotate(${deg}deg) translate(${translateX}px, ${translateY}px)`,
|
|
207
|
+
transition: enableTransition ? "transform .3s" : ""
|
|
208
|
+
};
|
|
209
|
+
if (mode.value.name === modes.CONTAIN.name) {
|
|
210
|
+
style.maxWidth = style.maxHeight = "100%";
|
|
211
|
+
}
|
|
212
|
+
return style;
|
|
213
|
+
});
|
|
214
|
+
const progress = computed(() => `${activeIndex.value + 1} / ${props.urlList.length}`);
|
|
215
|
+
function hide() {
|
|
216
|
+
unregisterEventListener();
|
|
217
|
+
stopWheelListener == null ? void 0 : stopWheelListener();
|
|
218
|
+
visible.value = false;
|
|
219
|
+
emit("close");
|
|
220
|
+
}
|
|
221
|
+
function registerEventListener() {
|
|
222
|
+
const keydownHandler = throttle((e) => {
|
|
223
|
+
const code = getEventCode(e);
|
|
224
|
+
switch (code) {
|
|
225
|
+
case EVENT_CODE.esc:
|
|
226
|
+
props.closeOnPressEscape && hide();
|
|
227
|
+
break;
|
|
228
|
+
case EVENT_CODE.space:
|
|
229
|
+
toggleMode();
|
|
230
|
+
break;
|
|
231
|
+
case EVENT_CODE.left:
|
|
232
|
+
prev();
|
|
233
|
+
break;
|
|
234
|
+
case EVENT_CODE.up:
|
|
235
|
+
handleActions("zoomIn");
|
|
236
|
+
break;
|
|
237
|
+
case EVENT_CODE.right:
|
|
238
|
+
next();
|
|
239
|
+
break;
|
|
240
|
+
case EVENT_CODE.down:
|
|
241
|
+
handleActions("zoomOut");
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
});
|
|
245
|
+
const mousewheelHandler = throttle((e) => {
|
|
246
|
+
const delta = e.deltaY || e.deltaX;
|
|
247
|
+
handleActions(delta < 0 ? "zoomIn" : "zoomOut", {
|
|
248
|
+
zoomRate: props.zoomRate,
|
|
249
|
+
enableTransition: false
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
scopeEventListener.run(() => {
|
|
253
|
+
useEventListener(document, "keydown", keydownHandler);
|
|
254
|
+
useEventListener(wrapper, "wheel", mousewheelHandler);
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
function unregisterEventListener() {
|
|
258
|
+
scopeEventListener.stop();
|
|
259
|
+
}
|
|
260
|
+
function handleImgLoad() {
|
|
261
|
+
loading.value = false;
|
|
262
|
+
}
|
|
263
|
+
function handleImgError(e) {
|
|
264
|
+
loadError.value = true;
|
|
265
|
+
loading.value = false;
|
|
266
|
+
emit("error", e);
|
|
267
|
+
e.target.alt = t("el.image.error");
|
|
268
|
+
}
|
|
269
|
+
function handleMouseDown(e) {
|
|
270
|
+
if (loading.value || e.button !== 0 || !wrapper.value)
|
|
271
|
+
return;
|
|
272
|
+
transform.value.enableTransition = false;
|
|
273
|
+
const { offsetX, offsetY } = transform.value;
|
|
274
|
+
const startX = e.pageX;
|
|
275
|
+
const startY = e.pageY;
|
|
276
|
+
const dragHandler = throttle((ev) => {
|
|
277
|
+
transform.value = {
|
|
278
|
+
...transform.value,
|
|
279
|
+
offsetX: offsetX + ev.pageX - startX,
|
|
280
|
+
offsetY: offsetY + ev.pageY - startY
|
|
281
|
+
};
|
|
282
|
+
});
|
|
283
|
+
const removeMousemove = useEventListener(document, "mousemove", dragHandler);
|
|
284
|
+
const removeMouseup = useEventListener(document, "mouseup", () => {
|
|
285
|
+
removeMousemove();
|
|
286
|
+
removeMouseup();
|
|
287
|
+
});
|
|
288
|
+
e.preventDefault();
|
|
289
|
+
}
|
|
290
|
+
function handleTouchStart(e) {
|
|
291
|
+
if (loading.value || !wrapper.value || e.touches.length !== 1)
|
|
292
|
+
return;
|
|
293
|
+
transform.value.enableTransition = false;
|
|
294
|
+
const { offsetX, offsetY } = transform.value;
|
|
295
|
+
const { pageX: startX, pageY: startY } = e.touches[0];
|
|
296
|
+
const dragHandler = throttle((ev) => {
|
|
297
|
+
const targetTouch = ev.touches[0];
|
|
298
|
+
transform.value = {
|
|
299
|
+
...transform.value,
|
|
300
|
+
offsetX: offsetX + targetTouch.pageX - startX,
|
|
301
|
+
offsetY: offsetY + targetTouch.pageY - startY
|
|
302
|
+
};
|
|
303
|
+
});
|
|
304
|
+
const removeTouchmove = useEventListener(document, "touchmove", dragHandler);
|
|
305
|
+
const removeTouchend = useEventListener(document, "touchend", () => {
|
|
306
|
+
removeTouchmove();
|
|
307
|
+
removeTouchend();
|
|
308
|
+
});
|
|
309
|
+
e.preventDefault();
|
|
310
|
+
}
|
|
311
|
+
function reset() {
|
|
312
|
+
transform.value = {
|
|
313
|
+
scale: scaleClamped.value,
|
|
314
|
+
deg: 0,
|
|
315
|
+
offsetX: 0,
|
|
316
|
+
offsetY: 0,
|
|
317
|
+
enableTransition: false
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
function toggleMode() {
|
|
321
|
+
if (loading.value || loadError.value)
|
|
322
|
+
return;
|
|
323
|
+
const modeNames = keysOf(modes);
|
|
324
|
+
const modeValues = Object.values(modes);
|
|
325
|
+
const currentMode = mode.value.name;
|
|
326
|
+
const index = modeValues.findIndex((i) => i.name === currentMode);
|
|
327
|
+
const nextIndex = (index + 1) % modeNames.length;
|
|
328
|
+
mode.value = modes[modeNames[nextIndex]];
|
|
329
|
+
reset();
|
|
330
|
+
}
|
|
331
|
+
function setActiveItem(index) {
|
|
332
|
+
loadError.value = false;
|
|
333
|
+
const len = props.urlList.length;
|
|
334
|
+
activeIndex.value = (index + len) % len;
|
|
335
|
+
}
|
|
336
|
+
function prev() {
|
|
337
|
+
if (isFirst.value && !props.infinite)
|
|
338
|
+
return;
|
|
339
|
+
setActiveItem(activeIndex.value - 1);
|
|
340
|
+
}
|
|
341
|
+
function next() {
|
|
342
|
+
if (isLast.value && !props.infinite)
|
|
343
|
+
return;
|
|
344
|
+
setActiveItem(activeIndex.value + 1);
|
|
345
|
+
}
|
|
346
|
+
function handleActions(action, options = {}) {
|
|
347
|
+
if (loading.value || loadError.value)
|
|
348
|
+
return;
|
|
349
|
+
const { minScale, maxScale } = props;
|
|
350
|
+
const { zoomRate, rotateDeg, enableTransition } = {
|
|
351
|
+
zoomRate: props.zoomRate,
|
|
352
|
+
rotateDeg: 90,
|
|
353
|
+
enableTransition: true,
|
|
354
|
+
...options
|
|
355
|
+
};
|
|
356
|
+
switch (action) {
|
|
357
|
+
case "zoomOut":
|
|
358
|
+
if (transform.value.scale > minScale) {
|
|
359
|
+
transform.value.scale = Number.parseFloat((transform.value.scale / zoomRate).toFixed(3));
|
|
360
|
+
}
|
|
361
|
+
break;
|
|
362
|
+
case "zoomIn":
|
|
363
|
+
if (transform.value.scale < maxScale) {
|
|
364
|
+
transform.value.scale = Number.parseFloat((transform.value.scale * zoomRate).toFixed(3));
|
|
365
|
+
}
|
|
366
|
+
break;
|
|
367
|
+
case "clockwise":
|
|
368
|
+
transform.value.deg += rotateDeg;
|
|
369
|
+
emit("rotate", transform.value.deg);
|
|
370
|
+
break;
|
|
371
|
+
case "anticlockwise":
|
|
372
|
+
transform.value.deg -= rotateDeg;
|
|
373
|
+
emit("rotate", transform.value.deg);
|
|
374
|
+
break;
|
|
375
|
+
}
|
|
376
|
+
transform.value.enableTransition = enableTransition;
|
|
377
|
+
}
|
|
378
|
+
function onFocusoutPrevented(event) {
|
|
379
|
+
var _a2;
|
|
380
|
+
if (((_a2 = event.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
|
|
381
|
+
event.preventDefault();
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
function onCloseRequested() {
|
|
385
|
+
if (props.closeOnPressEscape) {
|
|
386
|
+
hide();
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
function wheelHandler(e) {
|
|
390
|
+
if (!e.ctrlKey)
|
|
391
|
+
return;
|
|
392
|
+
if (e.deltaY < 0) {
|
|
393
|
+
e.preventDefault();
|
|
394
|
+
return false;
|
|
395
|
+
} else if (e.deltaY > 0) {
|
|
396
|
+
e.preventDefault();
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
watch(() => scaleClamped.value, (val) => {
|
|
401
|
+
transform.value.scale = val;
|
|
402
|
+
});
|
|
403
|
+
watch(currentImg, () => {
|
|
404
|
+
nextTick(() => {
|
|
405
|
+
const $img = imgRef.value;
|
|
406
|
+
if (!($img == null ? void 0 : $img.complete)) {
|
|
407
|
+
loading.value = true;
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
watch(activeIndex, (val) => {
|
|
412
|
+
reset();
|
|
413
|
+
emit("switch", val);
|
|
414
|
+
});
|
|
415
|
+
onMounted(() => {
|
|
416
|
+
visible.value = true;
|
|
417
|
+
registerEventListener();
|
|
418
|
+
stopWheelListener = useEventListener("wheel", wheelHandler, {
|
|
419
|
+
passive: false
|
|
420
|
+
});
|
|
421
|
+
});
|
|
422
|
+
expose({
|
|
423
|
+
setActiveItem
|
|
424
|
+
});
|
|
425
|
+
return (_ctx, _cache) => {
|
|
426
|
+
return openBlock(), createBlock(unref(ElTeleport), {
|
|
427
|
+
to: "body",
|
|
428
|
+
disabled: !_ctx.teleported
|
|
429
|
+
}, {
|
|
430
|
+
default: withCtx(() => [
|
|
431
|
+
createVNode(Transition, {
|
|
432
|
+
name: "viewer-fade",
|
|
433
|
+
appear: ""
|
|
434
|
+
}, {
|
|
435
|
+
default: withCtx(() => [
|
|
436
|
+
createElementVNode("div", {
|
|
437
|
+
ref_key: "wrapper",
|
|
438
|
+
ref: wrapper,
|
|
439
|
+
tabindex: -1,
|
|
440
|
+
class: normalizeClass(unref(ns).e("wrapper")),
|
|
441
|
+
style: normalizeStyle({ zIndex: zIndex.value })
|
|
442
|
+
}, [
|
|
443
|
+
createVNode(unref(ElFocusTrap), {
|
|
444
|
+
loop: "",
|
|
445
|
+
trapped: "",
|
|
446
|
+
"focus-trap-el": wrapper.value,
|
|
447
|
+
"focus-start-el": "container",
|
|
448
|
+
onFocusoutPrevented,
|
|
449
|
+
onReleaseRequested: onCloseRequested
|
|
450
|
+
}, {
|
|
451
|
+
default: withCtx(() => [
|
|
452
|
+
createElementVNode("div", {
|
|
453
|
+
class: normalizeClass(unref(ns).e("mask")),
|
|
454
|
+
onClick: withModifiers(($event) => _ctx.hideOnClickModal && hide(), ["self"])
|
|
455
|
+
}, null, 10, ["onClick"]),
|
|
456
|
+
createCommentVNode(" CLOSE "),
|
|
457
|
+
createElementVNode("span", {
|
|
458
|
+
class: normalizeClass([unref(ns).e("btn"), unref(ns).e("close")]),
|
|
459
|
+
onClick: hide
|
|
460
|
+
}, [
|
|
461
|
+
createVNode(unref(ElIcon), null, {
|
|
462
|
+
default: withCtx(() => [
|
|
463
|
+
createVNode(unref(Close))
|
|
464
|
+
]),
|
|
465
|
+
_: 1
|
|
466
|
+
})
|
|
467
|
+
], 2),
|
|
468
|
+
createCommentVNode(" ARROW "),
|
|
469
|
+
!unref(isSingle) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
470
|
+
createElementVNode("span", {
|
|
471
|
+
class: normalizeClass(unref(arrowPrevKls)),
|
|
472
|
+
onClick: prev
|
|
473
|
+
}, [
|
|
474
|
+
createVNode(unref(ElIcon), null, {
|
|
475
|
+
default: withCtx(() => [
|
|
476
|
+
createVNode(unref(ArrowLeft))
|
|
477
|
+
]),
|
|
478
|
+
_: 1
|
|
479
|
+
})
|
|
480
|
+
], 2),
|
|
481
|
+
createElementVNode("span", {
|
|
482
|
+
class: normalizeClass(unref(arrowNextKls)),
|
|
483
|
+
onClick: next
|
|
484
|
+
}, [
|
|
485
|
+
createVNode(unref(ElIcon), null, {
|
|
486
|
+
default: withCtx(() => [
|
|
487
|
+
createVNode(unref(ArrowRight))
|
|
488
|
+
]),
|
|
489
|
+
_: 1
|
|
490
|
+
})
|
|
491
|
+
], 2)
|
|
492
|
+
], 64)) : createCommentVNode("v-if", true),
|
|
493
|
+
_ctx.$slots.progress || _ctx.showProgress ? (openBlock(), createElementBlock("div", {
|
|
494
|
+
key: 1,
|
|
495
|
+
class: normalizeClass([unref(ns).e("btn"), unref(ns).e("progress")])
|
|
496
|
+
}, [
|
|
497
|
+
renderSlot(_ctx.$slots, "progress", {
|
|
498
|
+
activeIndex: activeIndex.value,
|
|
499
|
+
total: _ctx.urlList.length
|
|
500
|
+
}, () => [
|
|
501
|
+
createTextVNode(toDisplayString(unref(progress)), 1)
|
|
502
|
+
])
|
|
503
|
+
], 2)) : createCommentVNode("v-if", true),
|
|
504
|
+
createCommentVNode(" ACTIONS "),
|
|
505
|
+
createElementVNode("div", {
|
|
506
|
+
class: normalizeClass([unref(ns).e("btn"), unref(ns).e("actions")])
|
|
507
|
+
}, [
|
|
508
|
+
createElementVNode("div", {
|
|
509
|
+
class: normalizeClass(unref(ns).e("actions__inner"))
|
|
510
|
+
}, [
|
|
511
|
+
renderSlot(_ctx.$slots, "toolbar", {
|
|
512
|
+
actions: handleActions,
|
|
513
|
+
prev,
|
|
514
|
+
next,
|
|
515
|
+
reset: toggleMode,
|
|
516
|
+
activeIndex: activeIndex.value,
|
|
517
|
+
setActiveItem
|
|
518
|
+
}, () => [
|
|
519
|
+
createVNode(unref(ElIcon), {
|
|
520
|
+
onClick: ($event) => handleActions("zoomOut")
|
|
521
|
+
}, {
|
|
522
|
+
default: withCtx(() => [
|
|
523
|
+
createVNode(unref(ZoomOut))
|
|
524
|
+
]),
|
|
525
|
+
_: 1
|
|
526
|
+
}, 8, ["onClick"]),
|
|
527
|
+
createVNode(unref(ElIcon), {
|
|
528
|
+
onClick: ($event) => handleActions("zoomIn")
|
|
529
|
+
}, {
|
|
530
|
+
default: withCtx(() => [
|
|
531
|
+
createVNode(unref(ZoomIn))
|
|
532
|
+
]),
|
|
533
|
+
_: 1
|
|
534
|
+
}, 8, ["onClick"]),
|
|
535
|
+
createElementVNode("i", {
|
|
536
|
+
class: normalizeClass(unref(ns).e("actions__divider"))
|
|
537
|
+
}, null, 2),
|
|
538
|
+
createVNode(unref(ElIcon), { onClick: toggleMode }, {
|
|
539
|
+
default: withCtx(() => [
|
|
540
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(mode).icon)))
|
|
541
|
+
]),
|
|
542
|
+
_: 1
|
|
543
|
+
}),
|
|
544
|
+
createElementVNode("i", {
|
|
545
|
+
class: normalizeClass(unref(ns).e("actions__divider"))
|
|
546
|
+
}, null, 2),
|
|
547
|
+
createVNode(unref(ElIcon), {
|
|
548
|
+
onClick: ($event) => handleActions("anticlockwise")
|
|
549
|
+
}, {
|
|
550
|
+
default: withCtx(() => [
|
|
551
|
+
createVNode(unref(RefreshLeft))
|
|
552
|
+
]),
|
|
553
|
+
_: 1
|
|
554
|
+
}, 8, ["onClick"]),
|
|
555
|
+
createVNode(unref(ElIcon), {
|
|
556
|
+
onClick: ($event) => handleActions("clockwise")
|
|
557
|
+
}, {
|
|
558
|
+
default: withCtx(() => [
|
|
559
|
+
createVNode(unref(RefreshRight))
|
|
560
|
+
]),
|
|
561
|
+
_: 1
|
|
562
|
+
}, 8, ["onClick"])
|
|
563
|
+
])
|
|
564
|
+
], 2)
|
|
565
|
+
], 2),
|
|
566
|
+
createCommentVNode(" CANVAS "),
|
|
567
|
+
createElementVNode("div", {
|
|
568
|
+
class: normalizeClass(unref(ns).e("canvas"))
|
|
569
|
+
}, [
|
|
570
|
+
loadError.value && _ctx.$slots["viewer-error"] ? renderSlot(_ctx.$slots, "viewer-error", {
|
|
571
|
+
key: 0,
|
|
572
|
+
activeIndex: activeIndex.value,
|
|
573
|
+
src: unref(currentImg)
|
|
574
|
+
}) : (openBlock(), createElementBlock("img", {
|
|
575
|
+
ref_key: "imgRef",
|
|
576
|
+
ref: imgRef,
|
|
577
|
+
key: unref(currentImg),
|
|
578
|
+
src: unref(currentImg),
|
|
579
|
+
style: normalizeStyle(unref(imgStyle)),
|
|
580
|
+
class: normalizeClass(unref(ns).e("img")),
|
|
581
|
+
crossorigin: _ctx.crossorigin,
|
|
582
|
+
onLoad: handleImgLoad,
|
|
583
|
+
onError: handleImgError,
|
|
584
|
+
onMousedown: handleMouseDown,
|
|
585
|
+
onTouchstart: handleTouchStart
|
|
586
|
+
}, null, 46, ["src", "crossorigin"]))
|
|
587
|
+
], 2),
|
|
588
|
+
renderSlot(_ctx.$slots, "default")
|
|
589
|
+
]),
|
|
590
|
+
_: 3
|
|
591
|
+
}, 8, ["focus-trap-el"])
|
|
592
|
+
], 6)
|
|
593
|
+
]),
|
|
594
|
+
_: 3
|
|
595
|
+
})
|
|
596
|
+
]),
|
|
597
|
+
_: 3
|
|
598
|
+
}, 8, ["disabled"]);
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
var ImageViewer = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "image-viewer.vue"]]);
|
|
603
|
+
|
|
604
|
+
const ElImageViewer = withInstall(ImageViewer);
|
|
605
|
+
|
|
606
|
+
const imageProps = buildProps({
|
|
607
|
+
hideOnClickModal: Boolean,
|
|
608
|
+
src: {
|
|
609
|
+
type: String,
|
|
610
|
+
default: ""
|
|
611
|
+
},
|
|
612
|
+
fit: {
|
|
613
|
+
type: String,
|
|
614
|
+
values: ["", "contain", "cover", "fill", "none", "scale-down"],
|
|
615
|
+
default: ""
|
|
616
|
+
},
|
|
617
|
+
loading: {
|
|
618
|
+
type: String,
|
|
619
|
+
values: ["eager", "lazy"]
|
|
620
|
+
},
|
|
621
|
+
lazy: Boolean,
|
|
622
|
+
scrollContainer: {
|
|
623
|
+
type: definePropType([String, Object])
|
|
624
|
+
},
|
|
625
|
+
previewSrcList: {
|
|
626
|
+
type: definePropType(Array),
|
|
627
|
+
default: () => mutable([])
|
|
628
|
+
},
|
|
629
|
+
previewTeleported: Boolean,
|
|
630
|
+
zIndex: {
|
|
631
|
+
type: Number
|
|
632
|
+
},
|
|
633
|
+
initialIndex: {
|
|
634
|
+
type: Number,
|
|
635
|
+
default: 0
|
|
636
|
+
},
|
|
637
|
+
infinite: {
|
|
638
|
+
type: Boolean,
|
|
639
|
+
default: true
|
|
640
|
+
},
|
|
641
|
+
closeOnPressEscape: {
|
|
642
|
+
type: Boolean,
|
|
643
|
+
default: true
|
|
644
|
+
},
|
|
645
|
+
zoomRate: {
|
|
646
|
+
type: Number,
|
|
647
|
+
default: 1.2
|
|
648
|
+
},
|
|
649
|
+
scale: {
|
|
650
|
+
type: Number,
|
|
651
|
+
default: 1
|
|
652
|
+
},
|
|
653
|
+
minScale: {
|
|
654
|
+
type: Number,
|
|
655
|
+
default: 0.2
|
|
656
|
+
},
|
|
657
|
+
maxScale: {
|
|
658
|
+
type: Number,
|
|
659
|
+
default: 7
|
|
660
|
+
},
|
|
661
|
+
showProgress: Boolean,
|
|
662
|
+
crossorigin: {
|
|
663
|
+
type: definePropType(String)
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
const imageEmits = {
|
|
667
|
+
load: (evt) => evt instanceof Event,
|
|
668
|
+
error: (evt) => evt instanceof Event,
|
|
669
|
+
switch: (val) => isNumber(val),
|
|
670
|
+
close: () => true,
|
|
671
|
+
show: () => true
|
|
672
|
+
};
|
|
673
|
+
|
|
674
|
+
const __default__ = defineComponent({
|
|
675
|
+
name: "ElImage",
|
|
676
|
+
inheritAttrs: false
|
|
677
|
+
});
|
|
678
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
679
|
+
...__default__,
|
|
680
|
+
props: imageProps,
|
|
681
|
+
emits: imageEmits,
|
|
682
|
+
setup(__props, { expose, emit }) {
|
|
683
|
+
const props = __props;
|
|
684
|
+
const { t } = useLocale();
|
|
685
|
+
const ns = useNamespace("image");
|
|
686
|
+
const rawAttrs = useAttrs();
|
|
687
|
+
const containerAttrs = computed(() => {
|
|
688
|
+
return fromPairs(Object.entries(rawAttrs).filter(([key]) => /^(data-|on[A-Z])/i.test(key) || ["id", "style"].includes(key)));
|
|
689
|
+
});
|
|
690
|
+
const imgAttrs = useAttrs$1({
|
|
691
|
+
excludeListeners: true,
|
|
692
|
+
excludeKeys: computed(() => {
|
|
693
|
+
return Object.keys(containerAttrs.value);
|
|
694
|
+
})
|
|
695
|
+
});
|
|
696
|
+
const imageSrc = ref();
|
|
697
|
+
const hasLoadError = ref(false);
|
|
698
|
+
const isLoading = ref(true);
|
|
699
|
+
const showViewer = ref(false);
|
|
700
|
+
const container = ref();
|
|
701
|
+
const _scrollContainer = ref();
|
|
702
|
+
const supportLoading = isClient && "loading" in HTMLImageElement.prototype;
|
|
703
|
+
let stopScrollListener;
|
|
704
|
+
const imageKls = computed(() => [
|
|
705
|
+
ns.e("inner"),
|
|
706
|
+
preview.value && ns.e("preview"),
|
|
707
|
+
isLoading.value && ns.is("loading")
|
|
708
|
+
]);
|
|
709
|
+
const imageStyle = computed(() => {
|
|
710
|
+
const { fit } = props;
|
|
711
|
+
if (isClient && fit) {
|
|
712
|
+
return { objectFit: fit };
|
|
713
|
+
}
|
|
714
|
+
return {};
|
|
715
|
+
});
|
|
716
|
+
const preview = computed(() => {
|
|
717
|
+
const { previewSrcList } = props;
|
|
718
|
+
return isArray(previewSrcList) && previewSrcList.length > 0;
|
|
719
|
+
});
|
|
720
|
+
const imageIndex = computed(() => {
|
|
721
|
+
const { previewSrcList, initialIndex } = props;
|
|
722
|
+
let previewIndex = initialIndex;
|
|
723
|
+
if (initialIndex > previewSrcList.length - 1) {
|
|
724
|
+
previewIndex = 0;
|
|
725
|
+
}
|
|
726
|
+
return previewIndex;
|
|
727
|
+
});
|
|
728
|
+
const isManual = computed(() => {
|
|
729
|
+
if (props.loading === "eager")
|
|
730
|
+
return false;
|
|
731
|
+
return !supportLoading && props.loading === "lazy" || props.lazy;
|
|
732
|
+
});
|
|
733
|
+
const loadImage = () => {
|
|
734
|
+
if (!isClient)
|
|
735
|
+
return;
|
|
736
|
+
isLoading.value = true;
|
|
737
|
+
hasLoadError.value = false;
|
|
738
|
+
imageSrc.value = props.src;
|
|
739
|
+
};
|
|
740
|
+
function handleLoad(event) {
|
|
741
|
+
isLoading.value = false;
|
|
742
|
+
hasLoadError.value = false;
|
|
743
|
+
emit("load", event);
|
|
744
|
+
}
|
|
745
|
+
function handleError(event) {
|
|
746
|
+
isLoading.value = false;
|
|
747
|
+
hasLoadError.value = true;
|
|
748
|
+
emit("error", event);
|
|
749
|
+
}
|
|
750
|
+
function handleLazyLoad(isIntersecting) {
|
|
751
|
+
if (isIntersecting) {
|
|
752
|
+
loadImage();
|
|
753
|
+
removeLazyLoadListener();
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
const lazyLoadHandler = useThrottleFn(handleLazyLoad, 200, true);
|
|
757
|
+
async function addLazyLoadListener() {
|
|
758
|
+
var _a;
|
|
759
|
+
if (!isClient)
|
|
760
|
+
return;
|
|
761
|
+
await nextTick();
|
|
762
|
+
const { scrollContainer } = props;
|
|
763
|
+
if (isElement(scrollContainer)) {
|
|
764
|
+
_scrollContainer.value = scrollContainer;
|
|
765
|
+
} else if (isString(scrollContainer) && scrollContainer !== "") {
|
|
766
|
+
_scrollContainer.value = (_a = document.querySelector(scrollContainer)) != null ? _a : void 0;
|
|
767
|
+
} else if (container.value) {
|
|
768
|
+
const scrollContainer2 = getScrollContainer(container.value);
|
|
769
|
+
_scrollContainer.value = isWindow(scrollContainer2) ? void 0 : scrollContainer2;
|
|
770
|
+
}
|
|
771
|
+
const { stop } = useIntersectionObserver(container, ([entry]) => {
|
|
772
|
+
lazyLoadHandler(entry.isIntersecting);
|
|
773
|
+
}, { root: _scrollContainer });
|
|
774
|
+
stopScrollListener = stop;
|
|
775
|
+
}
|
|
776
|
+
function removeLazyLoadListener() {
|
|
777
|
+
if (!isClient || !lazyLoadHandler)
|
|
778
|
+
return;
|
|
779
|
+
stopScrollListener == null ? void 0 : stopScrollListener();
|
|
780
|
+
_scrollContainer.value = void 0;
|
|
781
|
+
stopScrollListener = void 0;
|
|
782
|
+
}
|
|
783
|
+
function clickHandler() {
|
|
784
|
+
if (!preview.value)
|
|
785
|
+
return;
|
|
786
|
+
showViewer.value = true;
|
|
787
|
+
emit("show");
|
|
788
|
+
}
|
|
789
|
+
function closeViewer() {
|
|
790
|
+
showViewer.value = false;
|
|
791
|
+
emit("close");
|
|
792
|
+
}
|
|
793
|
+
function switchViewer(val) {
|
|
794
|
+
emit("switch", val);
|
|
795
|
+
}
|
|
796
|
+
watch(() => props.src, () => {
|
|
797
|
+
if (isManual.value) {
|
|
798
|
+
isLoading.value = true;
|
|
799
|
+
hasLoadError.value = false;
|
|
800
|
+
removeLazyLoadListener();
|
|
801
|
+
addLazyLoadListener();
|
|
802
|
+
} else {
|
|
803
|
+
loadImage();
|
|
804
|
+
}
|
|
805
|
+
});
|
|
806
|
+
onMounted(() => {
|
|
807
|
+
if (isManual.value) {
|
|
808
|
+
addLazyLoadListener();
|
|
809
|
+
} else {
|
|
810
|
+
loadImage();
|
|
811
|
+
}
|
|
812
|
+
});
|
|
813
|
+
expose({
|
|
814
|
+
showPreview: clickHandler
|
|
815
|
+
});
|
|
816
|
+
return (_ctx, _cache) => {
|
|
817
|
+
return openBlock(), createElementBlock("div", mergeProps({
|
|
818
|
+
ref_key: "container",
|
|
819
|
+
ref: container
|
|
820
|
+
}, unref(containerAttrs), {
|
|
821
|
+
class: [unref(ns).b(), _ctx.$attrs.class]
|
|
822
|
+
}), [
|
|
823
|
+
hasLoadError.value ? renderSlot(_ctx.$slots, "error", { key: 0 }, () => [
|
|
824
|
+
createElementVNode("div", {
|
|
825
|
+
class: normalizeClass(unref(ns).e("error"))
|
|
826
|
+
}, toDisplayString(unref(t)("el.image.error")), 3)
|
|
827
|
+
]) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
828
|
+
imageSrc.value !== void 0 ? (openBlock(), createElementBlock("img", mergeProps({ key: 0 }, unref(imgAttrs), {
|
|
829
|
+
src: imageSrc.value,
|
|
830
|
+
loading: _ctx.loading,
|
|
831
|
+
style: unref(imageStyle),
|
|
832
|
+
class: unref(imageKls),
|
|
833
|
+
crossorigin: _ctx.crossorigin,
|
|
834
|
+
onClick: clickHandler,
|
|
835
|
+
onLoad: handleLoad,
|
|
836
|
+
onError: handleError
|
|
837
|
+
}), null, 16, ["src", "loading", "crossorigin"])) : createCommentVNode("v-if", true),
|
|
838
|
+
isLoading.value ? (openBlock(), createElementBlock("div", {
|
|
839
|
+
key: 1,
|
|
840
|
+
class: normalizeClass(unref(ns).e("wrapper"))
|
|
841
|
+
}, [
|
|
842
|
+
renderSlot(_ctx.$slots, "placeholder", {}, () => [
|
|
843
|
+
createElementVNode("div", {
|
|
844
|
+
class: normalizeClass(unref(ns).e("placeholder"))
|
|
845
|
+
}, null, 2)
|
|
846
|
+
])
|
|
847
|
+
], 2)) : createCommentVNode("v-if", true)
|
|
848
|
+
], 64)),
|
|
849
|
+
unref(preview) ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
850
|
+
showViewer.value ? (openBlock(), createBlock(unref(ElImageViewer), {
|
|
851
|
+
key: 0,
|
|
852
|
+
"z-index": _ctx.zIndex,
|
|
853
|
+
"initial-index": unref(imageIndex),
|
|
854
|
+
infinite: _ctx.infinite,
|
|
855
|
+
"zoom-rate": _ctx.zoomRate,
|
|
856
|
+
"min-scale": _ctx.minScale,
|
|
857
|
+
"max-scale": _ctx.maxScale,
|
|
858
|
+
"show-progress": _ctx.showProgress,
|
|
859
|
+
"url-list": _ctx.previewSrcList,
|
|
860
|
+
scale: _ctx.scale,
|
|
861
|
+
crossorigin: _ctx.crossorigin,
|
|
862
|
+
"hide-on-click-modal": _ctx.hideOnClickModal,
|
|
863
|
+
teleported: _ctx.previewTeleported,
|
|
864
|
+
"close-on-press-escape": _ctx.closeOnPressEscape,
|
|
865
|
+
onClose: closeViewer,
|
|
866
|
+
onSwitch: switchViewer
|
|
867
|
+
}, createSlots({
|
|
868
|
+
toolbar: withCtx((toolbar) => [
|
|
869
|
+
renderSlot(_ctx.$slots, "toolbar", normalizeProps(guardReactiveProps(toolbar)))
|
|
870
|
+
]),
|
|
871
|
+
default: withCtx(() => [
|
|
872
|
+
_ctx.$slots.viewer ? (openBlock(), createElementBlock("div", { key: 0 }, [
|
|
873
|
+
renderSlot(_ctx.$slots, "viewer")
|
|
874
|
+
])) : createCommentVNode("v-if", true)
|
|
875
|
+
]),
|
|
876
|
+
_: 2
|
|
877
|
+
}, [
|
|
878
|
+
_ctx.$slots.progress ? {
|
|
879
|
+
name: "progress",
|
|
880
|
+
fn: withCtx((progress) => [
|
|
881
|
+
renderSlot(_ctx.$slots, "progress", normalizeProps(guardReactiveProps(progress)))
|
|
882
|
+
])
|
|
883
|
+
} : void 0,
|
|
884
|
+
_ctx.$slots["viewer-error"] ? {
|
|
885
|
+
name: "viewer-error",
|
|
886
|
+
fn: withCtx((viewerError) => [
|
|
887
|
+
renderSlot(_ctx.$slots, "viewer-error", normalizeProps(guardReactiveProps(viewerError)))
|
|
888
|
+
])
|
|
889
|
+
} : void 0
|
|
890
|
+
]), 1032, ["z-index", "initial-index", "infinite", "zoom-rate", "min-scale", "max-scale", "show-progress", "url-list", "scale", "crossorigin", "hide-on-click-modal", "teleported", "close-on-press-escape"])) : createCommentVNode("v-if", true)
|
|
891
|
+
], 64)) : createCommentVNode("v-if", true)
|
|
892
|
+
], 16);
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
});
|
|
896
|
+
var Image = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "image.vue"]]);
|
|
897
|
+
|
|
898
|
+
const ElImage = withInstall(Image);
|
|
899
|
+
|
|
900
|
+
export { ElImage as E };
|