@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,1391 @@
|
|
|
1
|
+
import './index.css'
|
|
2
|
+
import { c as buildProps, d as definePropType, u as useNamespace, j as isFunction, h as isString, t as throwError, i as isArray, k as isNil, N as NOOP, l as isPlainObject, e as debugWarn } from '../../chunk/E_WRn0OP.mjs';
|
|
3
|
+
import { v as vLoading } from '../../chunk/CVlj9F0I.mjs';
|
|
4
|
+
import { E as ElButton } from '../../chunk/VCrtRnxt.mjs';
|
|
5
|
+
import { defineComponent, computed, createElementBlock, openBlock, normalizeClass, unref, createCommentVNode, createElementVNode, normalizeStyle, renderSlot, toDisplayString, createBlock, withCtx, resolveDynamicComponent, ref, TransitionGroup, Fragment, renderList, withKeys, withModifiers, createVNode, inject, shallowRef, watch, nextTick, onBeforeUnmount, provide, toRef, createSlots, mergeProps, isRef, withDirectives, createTextVNode } from 'vue';
|
|
6
|
+
import { d as defaultWindow } from '../../chunk/BdDihk0t.mjs';
|
|
7
|
+
import Draggable from 'vuedraggable-es-fix';
|
|
8
|
+
import { C as Component$1 } from '../dialog/dialog.mjs';
|
|
9
|
+
import { C as Component$2 } from '../el-icon/el-icon.mjs';
|
|
10
|
+
import { E as ElIcon } from '../../chunk/DMHNh_tw.mjs';
|
|
11
|
+
import { WarningFilled, CircleCheck, CircleClose, Check, Close, Document, ZoomIn, Delete } from '@element-plus/icons-vue';
|
|
12
|
+
import { _ as _export_sfc, w as withInstall } from '../../chunk/D389hx_T.mjs';
|
|
13
|
+
import { m as mutable } from '../../chunk/B-rxnVJv.mjs';
|
|
14
|
+
import { u as useLocale } from '../../chunk/aibQ9WSZ.mjs';
|
|
15
|
+
import { b as useFormDisabled } from '../../chunk/DZACQ9LT.mjs';
|
|
16
|
+
import { e as entriesOf } from '../../chunk/DVNTpOBR.mjs';
|
|
17
|
+
import { c as cloneDeep } from '../../chunk/CyxEcbcy.mjs';
|
|
18
|
+
import { i as isEqual } from '../../chunk/-EkpfdcW.mjs';
|
|
19
|
+
import { a as useVModel } from '../../chunk/CEClY-_T.mjs';
|
|
20
|
+
import { _ as _export_sfc$1 } from '../../chunk/pcqpp-6-.mjs';
|
|
21
|
+
|
|
22
|
+
const progressProps = buildProps({
|
|
23
|
+
type: {
|
|
24
|
+
type: String,
|
|
25
|
+
default: "line",
|
|
26
|
+
values: ["line", "circle", "dashboard"]
|
|
27
|
+
},
|
|
28
|
+
percentage: {
|
|
29
|
+
type: Number,
|
|
30
|
+
default: 0,
|
|
31
|
+
validator: (val) => val >= 0 && val <= 100
|
|
32
|
+
},
|
|
33
|
+
status: {
|
|
34
|
+
type: String,
|
|
35
|
+
default: "",
|
|
36
|
+
values: ["", "success", "exception", "warning"]
|
|
37
|
+
},
|
|
38
|
+
indeterminate: Boolean,
|
|
39
|
+
duration: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: 3
|
|
42
|
+
},
|
|
43
|
+
strokeWidth: {
|
|
44
|
+
type: Number,
|
|
45
|
+
default: 6
|
|
46
|
+
},
|
|
47
|
+
strokeLinecap: {
|
|
48
|
+
type: definePropType(String),
|
|
49
|
+
default: "round"
|
|
50
|
+
},
|
|
51
|
+
textInside: Boolean,
|
|
52
|
+
width: {
|
|
53
|
+
type: Number,
|
|
54
|
+
default: 126
|
|
55
|
+
},
|
|
56
|
+
showText: {
|
|
57
|
+
type: Boolean,
|
|
58
|
+
default: true
|
|
59
|
+
},
|
|
60
|
+
color: {
|
|
61
|
+
type: definePropType([
|
|
62
|
+
String,
|
|
63
|
+
Array,
|
|
64
|
+
Function
|
|
65
|
+
]),
|
|
66
|
+
default: ""
|
|
67
|
+
},
|
|
68
|
+
striped: Boolean,
|
|
69
|
+
stripedFlow: Boolean,
|
|
70
|
+
format: {
|
|
71
|
+
type: definePropType(Function),
|
|
72
|
+
default: (percentage) => `${percentage}%`
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const __default__$4 = defineComponent({
|
|
77
|
+
name: "ElProgress"
|
|
78
|
+
});
|
|
79
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
80
|
+
...__default__$4,
|
|
81
|
+
props: progressProps,
|
|
82
|
+
setup(__props) {
|
|
83
|
+
const props = __props;
|
|
84
|
+
const STATUS_COLOR_MAP = {
|
|
85
|
+
success: "#13ce66",
|
|
86
|
+
exception: "#ff4949",
|
|
87
|
+
warning: "#e6a23c",
|
|
88
|
+
default: "#20a0ff"
|
|
89
|
+
};
|
|
90
|
+
const ns = useNamespace("progress");
|
|
91
|
+
const barStyle = computed(() => {
|
|
92
|
+
const barStyle2 = {
|
|
93
|
+
width: `${props.percentage}%`,
|
|
94
|
+
animationDuration: `${props.duration}s`
|
|
95
|
+
};
|
|
96
|
+
const color = getCurrentColor(props.percentage);
|
|
97
|
+
if (color.includes("gradient")) {
|
|
98
|
+
barStyle2.background = color;
|
|
99
|
+
} else {
|
|
100
|
+
barStyle2.backgroundColor = color;
|
|
101
|
+
}
|
|
102
|
+
return barStyle2;
|
|
103
|
+
});
|
|
104
|
+
const relativeStrokeWidth = computed(() => (props.strokeWidth / props.width * 100).toFixed(1));
|
|
105
|
+
const radius = computed(() => {
|
|
106
|
+
if (["circle", "dashboard"].includes(props.type)) {
|
|
107
|
+
return Number.parseInt(`${50 - Number.parseFloat(relativeStrokeWidth.value) / 2}`, 10);
|
|
108
|
+
}
|
|
109
|
+
return 0;
|
|
110
|
+
});
|
|
111
|
+
const trackPath = computed(() => {
|
|
112
|
+
const r = radius.value;
|
|
113
|
+
const isDashboard = props.type === "dashboard";
|
|
114
|
+
return `
|
|
115
|
+
M 50 50
|
|
116
|
+
m 0 ${isDashboard ? "" : "-"}${r}
|
|
117
|
+
a ${r} ${r} 0 1 1 0 ${isDashboard ? "-" : ""}${r * 2}
|
|
118
|
+
a ${r} ${r} 0 1 1 0 ${isDashboard ? "" : "-"}${r * 2}
|
|
119
|
+
`;
|
|
120
|
+
});
|
|
121
|
+
const perimeter = computed(() => 2 * Math.PI * radius.value);
|
|
122
|
+
const rate = computed(() => props.type === "dashboard" ? 0.75 : 1);
|
|
123
|
+
const strokeDashoffset = computed(() => {
|
|
124
|
+
const offset = -1 * perimeter.value * (1 - rate.value) / 2;
|
|
125
|
+
return `${offset}px`;
|
|
126
|
+
});
|
|
127
|
+
const trailPathStyle = computed(() => ({
|
|
128
|
+
strokeDasharray: `${perimeter.value * rate.value}px, ${perimeter.value}px`,
|
|
129
|
+
strokeDashoffset: strokeDashoffset.value
|
|
130
|
+
}));
|
|
131
|
+
const circlePathStyle = computed(() => ({
|
|
132
|
+
strokeDasharray: `${perimeter.value * rate.value * (props.percentage / 100)}px, ${perimeter.value}px`,
|
|
133
|
+
strokeDashoffset: strokeDashoffset.value,
|
|
134
|
+
transition: "stroke-dasharray 0.6s ease 0s, stroke 0.6s ease, opacity ease 0.6s"
|
|
135
|
+
}));
|
|
136
|
+
const stroke = computed(() => {
|
|
137
|
+
let ret;
|
|
138
|
+
if (props.color) {
|
|
139
|
+
ret = getCurrentColor(props.percentage);
|
|
140
|
+
} else {
|
|
141
|
+
ret = STATUS_COLOR_MAP[props.status] || STATUS_COLOR_MAP.default;
|
|
142
|
+
}
|
|
143
|
+
return ret;
|
|
144
|
+
});
|
|
145
|
+
const statusIcon = computed(() => {
|
|
146
|
+
if (props.status === "warning") {
|
|
147
|
+
return WarningFilled;
|
|
148
|
+
}
|
|
149
|
+
if (props.type === "line") {
|
|
150
|
+
return props.status === "success" ? CircleCheck : CircleClose;
|
|
151
|
+
} else {
|
|
152
|
+
return props.status === "success" ? Check : Close;
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
const progressTextSize = computed(() => {
|
|
156
|
+
return props.type === "line" ? 12 + props.strokeWidth * 0.4 : props.width * 0.111111 + 2;
|
|
157
|
+
});
|
|
158
|
+
const content = computed(() => props.format(props.percentage));
|
|
159
|
+
function getColors(color) {
|
|
160
|
+
const span = 100 / color.length;
|
|
161
|
+
const seriesColors = color.map((seriesColor, index) => {
|
|
162
|
+
if (isString(seriesColor)) {
|
|
163
|
+
return {
|
|
164
|
+
color: seriesColor,
|
|
165
|
+
percentage: (index + 1) * span
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
return seriesColor;
|
|
169
|
+
});
|
|
170
|
+
return seriesColors.sort((a, b) => a.percentage - b.percentage);
|
|
171
|
+
}
|
|
172
|
+
const getCurrentColor = (percentage) => {
|
|
173
|
+
var _a;
|
|
174
|
+
const { color } = props;
|
|
175
|
+
if (isFunction(color)) {
|
|
176
|
+
return color(percentage);
|
|
177
|
+
} else if (isString(color)) {
|
|
178
|
+
return color;
|
|
179
|
+
} else {
|
|
180
|
+
const colors = getColors(color);
|
|
181
|
+
for (const color2 of colors) {
|
|
182
|
+
if (color2.percentage > percentage)
|
|
183
|
+
return color2.color;
|
|
184
|
+
}
|
|
185
|
+
return (_a = colors[colors.length - 1]) == null ? void 0 : _a.color;
|
|
186
|
+
}
|
|
187
|
+
};
|
|
188
|
+
return (_ctx, _cache) => {
|
|
189
|
+
return openBlock(), createElementBlock("div", {
|
|
190
|
+
class: normalizeClass([
|
|
191
|
+
unref(ns).b(),
|
|
192
|
+
unref(ns).m(_ctx.type),
|
|
193
|
+
unref(ns).is(_ctx.status),
|
|
194
|
+
{
|
|
195
|
+
[unref(ns).m("without-text")]: !_ctx.showText,
|
|
196
|
+
[unref(ns).m("text-inside")]: _ctx.textInside
|
|
197
|
+
}
|
|
198
|
+
]),
|
|
199
|
+
role: "progressbar",
|
|
200
|
+
"aria-valuenow": _ctx.percentage,
|
|
201
|
+
"aria-valuemin": "0",
|
|
202
|
+
"aria-valuemax": "100"
|
|
203
|
+
}, [
|
|
204
|
+
_ctx.type === "line" ? (openBlock(), createElementBlock("div", {
|
|
205
|
+
key: 0,
|
|
206
|
+
class: normalizeClass(unref(ns).b("bar"))
|
|
207
|
+
}, [
|
|
208
|
+
createElementVNode("div", {
|
|
209
|
+
class: normalizeClass(unref(ns).be("bar", "outer")),
|
|
210
|
+
style: normalizeStyle({ height: `${_ctx.strokeWidth}px` })
|
|
211
|
+
}, [
|
|
212
|
+
createElementVNode("div", {
|
|
213
|
+
class: normalizeClass([
|
|
214
|
+
unref(ns).be("bar", "inner"),
|
|
215
|
+
{ [unref(ns).bem("bar", "inner", "indeterminate")]: _ctx.indeterminate },
|
|
216
|
+
{ [unref(ns).bem("bar", "inner", "striped")]: _ctx.striped },
|
|
217
|
+
{ [unref(ns).bem("bar", "inner", "striped-flow")]: _ctx.stripedFlow }
|
|
218
|
+
]),
|
|
219
|
+
style: normalizeStyle(unref(barStyle))
|
|
220
|
+
}, [
|
|
221
|
+
(_ctx.showText || _ctx.$slots.default) && _ctx.textInside ? (openBlock(), createElementBlock("div", {
|
|
222
|
+
key: 0,
|
|
223
|
+
class: normalizeClass(unref(ns).be("bar", "innerText"))
|
|
224
|
+
}, [
|
|
225
|
+
renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
|
|
226
|
+
createElementVNode("span", null, toDisplayString(unref(content)), 1)
|
|
227
|
+
])
|
|
228
|
+
], 2)) : createCommentVNode("v-if", true)
|
|
229
|
+
], 6)
|
|
230
|
+
], 6)
|
|
231
|
+
], 2)) : (openBlock(), createElementBlock("div", {
|
|
232
|
+
key: 1,
|
|
233
|
+
class: normalizeClass(unref(ns).b("circle")),
|
|
234
|
+
style: normalizeStyle({ height: `${_ctx.width}px`, width: `${_ctx.width}px` })
|
|
235
|
+
}, [
|
|
236
|
+
(openBlock(), createElementBlock("svg", { viewBox: "0 0 100 100" }, [
|
|
237
|
+
createElementVNode("path", {
|
|
238
|
+
class: normalizeClass(unref(ns).be("circle", "track")),
|
|
239
|
+
d: unref(trackPath),
|
|
240
|
+
stroke: `var(${unref(ns).cssVarName("fill-color-light")}, #e5e9f2)`,
|
|
241
|
+
"stroke-linecap": _ctx.strokeLinecap,
|
|
242
|
+
"stroke-width": unref(relativeStrokeWidth),
|
|
243
|
+
fill: "none",
|
|
244
|
+
style: normalizeStyle(unref(trailPathStyle))
|
|
245
|
+
}, null, 14, ["d", "stroke", "stroke-linecap", "stroke-width"]),
|
|
246
|
+
createElementVNode("path", {
|
|
247
|
+
class: normalizeClass(unref(ns).be("circle", "path")),
|
|
248
|
+
d: unref(trackPath),
|
|
249
|
+
stroke: unref(stroke),
|
|
250
|
+
fill: "none",
|
|
251
|
+
opacity: _ctx.percentage ? 1 : 0,
|
|
252
|
+
"stroke-linecap": _ctx.strokeLinecap,
|
|
253
|
+
"stroke-width": unref(relativeStrokeWidth),
|
|
254
|
+
style: normalizeStyle(unref(circlePathStyle))
|
|
255
|
+
}, null, 14, ["d", "stroke", "opacity", "stroke-linecap", "stroke-width"])
|
|
256
|
+
]))
|
|
257
|
+
], 6)),
|
|
258
|
+
(_ctx.showText || _ctx.$slots.default) && !_ctx.textInside ? (openBlock(), createElementBlock("div", {
|
|
259
|
+
key: 2,
|
|
260
|
+
class: normalizeClass(unref(ns).e("text")),
|
|
261
|
+
style: normalizeStyle({ fontSize: `${unref(progressTextSize)}px` })
|
|
262
|
+
}, [
|
|
263
|
+
renderSlot(_ctx.$slots, "default", { percentage: _ctx.percentage }, () => [
|
|
264
|
+
!_ctx.status ? (openBlock(), createElementBlock("span", { key: 0 }, toDisplayString(unref(content)), 1)) : (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
|
|
265
|
+
default: withCtx(() => [
|
|
266
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(statusIcon))))
|
|
267
|
+
]),
|
|
268
|
+
_: 1
|
|
269
|
+
}))
|
|
270
|
+
])
|
|
271
|
+
], 6)) : createCommentVNode("v-if", true)
|
|
272
|
+
], 10, ["aria-valuenow"]);
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
var Progress = /* @__PURE__ */ _export_sfc(_sfc_main$5, [["__file", "progress.vue"]]);
|
|
277
|
+
|
|
278
|
+
const ElProgress = withInstall(Progress);
|
|
279
|
+
|
|
280
|
+
const uploadContextKey = Symbol("uploadContextKey");
|
|
281
|
+
|
|
282
|
+
const SCOPE$1 = "ElUpload";
|
|
283
|
+
class UploadAjaxError extends Error {
|
|
284
|
+
constructor(message, status, method, url) {
|
|
285
|
+
super(message);
|
|
286
|
+
this.name = "UploadAjaxError";
|
|
287
|
+
this.status = status;
|
|
288
|
+
this.method = method;
|
|
289
|
+
this.url = url;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
function getError(action, option, xhr) {
|
|
293
|
+
let msg;
|
|
294
|
+
if (xhr.response) {
|
|
295
|
+
msg = `${xhr.response.error || xhr.response}`;
|
|
296
|
+
} else if (xhr.responseText) {
|
|
297
|
+
msg = `${xhr.responseText}`;
|
|
298
|
+
} else {
|
|
299
|
+
msg = `fail to ${option.method} ${action} ${xhr.status}`;
|
|
300
|
+
}
|
|
301
|
+
return new UploadAjaxError(msg, xhr.status, option.method, action);
|
|
302
|
+
}
|
|
303
|
+
function getBody(xhr) {
|
|
304
|
+
const text = xhr.responseText || xhr.response;
|
|
305
|
+
if (!text) {
|
|
306
|
+
return text;
|
|
307
|
+
}
|
|
308
|
+
try {
|
|
309
|
+
return JSON.parse(text);
|
|
310
|
+
} catch (e) {
|
|
311
|
+
return text;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
const ajaxUpload = (option) => {
|
|
315
|
+
if (typeof XMLHttpRequest === "undefined")
|
|
316
|
+
throwError(SCOPE$1, "XMLHttpRequest is undefined");
|
|
317
|
+
const xhr = new XMLHttpRequest();
|
|
318
|
+
const action = option.action;
|
|
319
|
+
if (xhr.upload) {
|
|
320
|
+
xhr.upload.addEventListener("progress", (evt) => {
|
|
321
|
+
const progressEvt = evt;
|
|
322
|
+
progressEvt.percent = evt.total > 0 ? evt.loaded / evt.total * 100 : 0;
|
|
323
|
+
option.onProgress(progressEvt);
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
const formData = new FormData();
|
|
327
|
+
if (option.data) {
|
|
328
|
+
for (const [key, value] of Object.entries(option.data)) {
|
|
329
|
+
if (isArray(value) && value.length)
|
|
330
|
+
formData.append(key, ...value);
|
|
331
|
+
else
|
|
332
|
+
formData.append(key, value);
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
formData.append(option.filename, option.file, option.file.name);
|
|
336
|
+
xhr.addEventListener("error", () => {
|
|
337
|
+
option.onError(getError(action, option, xhr));
|
|
338
|
+
});
|
|
339
|
+
xhr.addEventListener("load", () => {
|
|
340
|
+
if (xhr.status < 200 || xhr.status >= 300) {
|
|
341
|
+
return option.onError(getError(action, option, xhr));
|
|
342
|
+
}
|
|
343
|
+
option.onSuccess(getBody(xhr));
|
|
344
|
+
});
|
|
345
|
+
xhr.open(option.method, action, true);
|
|
346
|
+
if (option.withCredentials && "withCredentials" in xhr) {
|
|
347
|
+
xhr.withCredentials = true;
|
|
348
|
+
}
|
|
349
|
+
const headers = option.headers || {};
|
|
350
|
+
if (headers instanceof Headers) {
|
|
351
|
+
headers.forEach((value, key) => xhr.setRequestHeader(key, value));
|
|
352
|
+
} else {
|
|
353
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
354
|
+
if (isNil(value))
|
|
355
|
+
continue;
|
|
356
|
+
xhr.setRequestHeader(key, String(value));
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
xhr.send(formData);
|
|
360
|
+
return xhr;
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
const uploadListTypes = ["text", "picture", "picture-card"];
|
|
364
|
+
let fileId = 1;
|
|
365
|
+
const genFileId = () => Date.now() + fileId++;
|
|
366
|
+
const uploadBaseProps = buildProps({
|
|
367
|
+
action: {
|
|
368
|
+
type: String,
|
|
369
|
+
default: "#"
|
|
370
|
+
},
|
|
371
|
+
headers: {
|
|
372
|
+
type: definePropType(Object)
|
|
373
|
+
},
|
|
374
|
+
method: {
|
|
375
|
+
type: String,
|
|
376
|
+
default: "post"
|
|
377
|
+
},
|
|
378
|
+
data: {
|
|
379
|
+
type: definePropType([Object, Function, Promise]),
|
|
380
|
+
default: () => mutable({})
|
|
381
|
+
},
|
|
382
|
+
multiple: Boolean,
|
|
383
|
+
name: {
|
|
384
|
+
type: String,
|
|
385
|
+
default: "file"
|
|
386
|
+
},
|
|
387
|
+
drag: Boolean,
|
|
388
|
+
withCredentials: Boolean,
|
|
389
|
+
showFileList: {
|
|
390
|
+
type: Boolean,
|
|
391
|
+
default: true
|
|
392
|
+
},
|
|
393
|
+
accept: {
|
|
394
|
+
type: String,
|
|
395
|
+
default: ""
|
|
396
|
+
},
|
|
397
|
+
fileList: {
|
|
398
|
+
type: definePropType(Array),
|
|
399
|
+
default: () => mutable([])
|
|
400
|
+
},
|
|
401
|
+
autoUpload: {
|
|
402
|
+
type: Boolean,
|
|
403
|
+
default: true
|
|
404
|
+
},
|
|
405
|
+
listType: {
|
|
406
|
+
type: String,
|
|
407
|
+
values: uploadListTypes,
|
|
408
|
+
default: "text"
|
|
409
|
+
},
|
|
410
|
+
httpRequest: {
|
|
411
|
+
type: definePropType(Function),
|
|
412
|
+
default: ajaxUpload
|
|
413
|
+
},
|
|
414
|
+
disabled: {
|
|
415
|
+
type: Boolean,
|
|
416
|
+
default: void 0
|
|
417
|
+
},
|
|
418
|
+
limit: Number
|
|
419
|
+
});
|
|
420
|
+
const uploadProps = buildProps({
|
|
421
|
+
...uploadBaseProps,
|
|
422
|
+
beforeUpload: {
|
|
423
|
+
type: definePropType(Function),
|
|
424
|
+
default: NOOP
|
|
425
|
+
},
|
|
426
|
+
beforeRemove: {
|
|
427
|
+
type: definePropType(Function)
|
|
428
|
+
},
|
|
429
|
+
onRemove: {
|
|
430
|
+
type: definePropType(Function),
|
|
431
|
+
default: NOOP
|
|
432
|
+
},
|
|
433
|
+
onChange: {
|
|
434
|
+
type: definePropType(Function),
|
|
435
|
+
default: NOOP
|
|
436
|
+
},
|
|
437
|
+
onPreview: {
|
|
438
|
+
type: definePropType(Function),
|
|
439
|
+
default: NOOP
|
|
440
|
+
},
|
|
441
|
+
onSuccess: {
|
|
442
|
+
type: definePropType(Function),
|
|
443
|
+
default: NOOP
|
|
444
|
+
},
|
|
445
|
+
onProgress: {
|
|
446
|
+
type: definePropType(Function),
|
|
447
|
+
default: NOOP
|
|
448
|
+
},
|
|
449
|
+
onError: {
|
|
450
|
+
type: definePropType(Function),
|
|
451
|
+
default: NOOP
|
|
452
|
+
},
|
|
453
|
+
onExceed: {
|
|
454
|
+
type: definePropType(Function),
|
|
455
|
+
default: NOOP
|
|
456
|
+
},
|
|
457
|
+
crossorigin: {
|
|
458
|
+
type: definePropType(String)
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
const uploadListProps = buildProps({
|
|
463
|
+
files: {
|
|
464
|
+
type: definePropType(Array),
|
|
465
|
+
default: () => mutable([])
|
|
466
|
+
},
|
|
467
|
+
disabled: {
|
|
468
|
+
type: Boolean,
|
|
469
|
+
default: void 0
|
|
470
|
+
},
|
|
471
|
+
handlePreview: {
|
|
472
|
+
type: definePropType(Function),
|
|
473
|
+
default: NOOP
|
|
474
|
+
},
|
|
475
|
+
listType: {
|
|
476
|
+
type: String,
|
|
477
|
+
values: uploadListTypes,
|
|
478
|
+
default: "text"
|
|
479
|
+
},
|
|
480
|
+
crossorigin: {
|
|
481
|
+
type: definePropType(String)
|
|
482
|
+
}
|
|
483
|
+
});
|
|
484
|
+
const uploadListEmits = {
|
|
485
|
+
remove: (file) => !!file
|
|
486
|
+
};
|
|
487
|
+
|
|
488
|
+
const __default__$3 = defineComponent({
|
|
489
|
+
name: "ElUploadList"
|
|
490
|
+
});
|
|
491
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
492
|
+
...__default__$3,
|
|
493
|
+
props: uploadListProps,
|
|
494
|
+
emits: uploadListEmits,
|
|
495
|
+
setup(__props, { emit }) {
|
|
496
|
+
const props = __props;
|
|
497
|
+
const { t } = useLocale();
|
|
498
|
+
const nsUpload = useNamespace("upload");
|
|
499
|
+
const nsIcon = useNamespace("icon");
|
|
500
|
+
const nsList = useNamespace("list");
|
|
501
|
+
const disabled = useFormDisabled();
|
|
502
|
+
const focusing = ref(false);
|
|
503
|
+
const containerKls = computed(() => [
|
|
504
|
+
nsUpload.b("list"),
|
|
505
|
+
nsUpload.bm("list", props.listType),
|
|
506
|
+
nsUpload.is("disabled", disabled.value)
|
|
507
|
+
]);
|
|
508
|
+
const handleRemove = (file) => {
|
|
509
|
+
emit("remove", file);
|
|
510
|
+
};
|
|
511
|
+
return (_ctx, _cache) => {
|
|
512
|
+
return openBlock(), createBlock(TransitionGroup, {
|
|
513
|
+
tag: "ul",
|
|
514
|
+
class: normalizeClass(unref(containerKls)),
|
|
515
|
+
name: unref(nsList).b()
|
|
516
|
+
}, {
|
|
517
|
+
default: withCtx(() => [
|
|
518
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.files, (file, index) => {
|
|
519
|
+
return openBlock(), createElementBlock("li", {
|
|
520
|
+
key: file.uid || file.name,
|
|
521
|
+
class: normalizeClass([
|
|
522
|
+
unref(nsUpload).be("list", "item"),
|
|
523
|
+
unref(nsUpload).is(file.status),
|
|
524
|
+
{ focusing: focusing.value }
|
|
525
|
+
]),
|
|
526
|
+
tabindex: unref(disabled) ? void 0 : 0,
|
|
527
|
+
"aria-disabled": unref(disabled),
|
|
528
|
+
role: "button",
|
|
529
|
+
onKeydown: withKeys(($event) => !unref(disabled) && handleRemove(file), ["delete"]),
|
|
530
|
+
onFocus: ($event) => focusing.value = true,
|
|
531
|
+
onBlur: ($event) => focusing.value = false,
|
|
532
|
+
onClick: ($event) => focusing.value = false
|
|
533
|
+
}, [
|
|
534
|
+
renderSlot(_ctx.$slots, "default", {
|
|
535
|
+
file,
|
|
536
|
+
index
|
|
537
|
+
}, () => [
|
|
538
|
+
_ctx.listType === "picture" || file.status !== "uploading" && _ctx.listType === "picture-card" ? (openBlock(), createElementBlock("img", {
|
|
539
|
+
key: 0,
|
|
540
|
+
class: normalizeClass(unref(nsUpload).be("list", "item-thumbnail")),
|
|
541
|
+
src: file.url,
|
|
542
|
+
crossorigin: _ctx.crossorigin,
|
|
543
|
+
alt: ""
|
|
544
|
+
}, null, 10, ["src", "crossorigin"])) : createCommentVNode("v-if", true),
|
|
545
|
+
file.status === "uploading" || _ctx.listType !== "picture-card" ? (openBlock(), createElementBlock("div", {
|
|
546
|
+
key: 1,
|
|
547
|
+
class: normalizeClass(unref(nsUpload).be("list", "item-info"))
|
|
548
|
+
}, [
|
|
549
|
+
createElementVNode("a", {
|
|
550
|
+
class: normalizeClass(unref(nsUpload).be("list", "item-name")),
|
|
551
|
+
onClick: withModifiers(($event) => _ctx.handlePreview(file), ["prevent"])
|
|
552
|
+
}, [
|
|
553
|
+
createVNode(unref(ElIcon), {
|
|
554
|
+
class: normalizeClass(unref(nsIcon).m("document"))
|
|
555
|
+
}, {
|
|
556
|
+
default: withCtx(() => [
|
|
557
|
+
createVNode(unref(Document))
|
|
558
|
+
]),
|
|
559
|
+
_: 1
|
|
560
|
+
}, 8, ["class"]),
|
|
561
|
+
createElementVNode("span", {
|
|
562
|
+
class: normalizeClass(unref(nsUpload).be("list", "item-file-name")),
|
|
563
|
+
title: file.name
|
|
564
|
+
}, toDisplayString(file.name), 11, ["title"])
|
|
565
|
+
], 10, ["onClick"]),
|
|
566
|
+
file.status === "uploading" ? (openBlock(), createBlock(unref(ElProgress), {
|
|
567
|
+
key: 0,
|
|
568
|
+
type: _ctx.listType === "picture-card" ? "circle" : "line",
|
|
569
|
+
"stroke-width": _ctx.listType === "picture-card" ? 6 : 2,
|
|
570
|
+
percentage: Number(file.percentage),
|
|
571
|
+
style: normalizeStyle(_ctx.listType === "picture-card" ? "" : "margin-top: 0.5rem")
|
|
572
|
+
}, null, 8, ["type", "stroke-width", "percentage", "style"])) : createCommentVNode("v-if", true)
|
|
573
|
+
], 2)) : createCommentVNode("v-if", true),
|
|
574
|
+
createElementVNode("label", {
|
|
575
|
+
class: normalizeClass(unref(nsUpload).be("list", "item-status-label"))
|
|
576
|
+
}, [
|
|
577
|
+
_ctx.listType === "text" ? (openBlock(), createBlock(unref(ElIcon), {
|
|
578
|
+
key: 0,
|
|
579
|
+
class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("circle-check")])
|
|
580
|
+
}, {
|
|
581
|
+
default: withCtx(() => [
|
|
582
|
+
createVNode(unref(CircleCheck))
|
|
583
|
+
]),
|
|
584
|
+
_: 1
|
|
585
|
+
}, 8, ["class"])) : ["picture-card", "picture"].includes(_ctx.listType) ? (openBlock(), createBlock(unref(ElIcon), {
|
|
586
|
+
key: 1,
|
|
587
|
+
class: normalizeClass([unref(nsIcon).m("upload-success"), unref(nsIcon).m("check")])
|
|
588
|
+
}, {
|
|
589
|
+
default: withCtx(() => [
|
|
590
|
+
createVNode(unref(Check))
|
|
591
|
+
]),
|
|
592
|
+
_: 1
|
|
593
|
+
}, 8, ["class"])) : createCommentVNode("v-if", true)
|
|
594
|
+
], 2),
|
|
595
|
+
!unref(disabled) ? (openBlock(), createBlock(unref(ElIcon), {
|
|
596
|
+
key: 2,
|
|
597
|
+
class: normalizeClass(unref(nsIcon).m("close")),
|
|
598
|
+
onClick: ($event) => handleRemove(file)
|
|
599
|
+
}, {
|
|
600
|
+
default: withCtx(() => [
|
|
601
|
+
createVNode(unref(Close))
|
|
602
|
+
]),
|
|
603
|
+
_: 2
|
|
604
|
+
}, 1032, ["class", "onClick"])) : createCommentVNode("v-if", true),
|
|
605
|
+
createCommentVNode(" Due to close btn only appears when li gets focused disappears after li gets blurred, thus keyboard navigation can never reach close btn"),
|
|
606
|
+
createCommentVNode(" This is a bug which needs to be fixed "),
|
|
607
|
+
createCommentVNode(" TODO: Fix the incorrect navigation interaction "),
|
|
608
|
+
!unref(disabled) ? (openBlock(), createElementBlock("i", {
|
|
609
|
+
key: 3,
|
|
610
|
+
class: normalizeClass(unref(nsIcon).m("close-tip"))
|
|
611
|
+
}, toDisplayString(unref(t)("el.upload.deleteTip")), 3)) : createCommentVNode("v-if", true),
|
|
612
|
+
_ctx.listType === "picture-card" ? (openBlock(), createElementBlock("span", {
|
|
613
|
+
key: 4,
|
|
614
|
+
class: normalizeClass(unref(nsUpload).be("list", "item-actions"))
|
|
615
|
+
}, [
|
|
616
|
+
createElementVNode("span", {
|
|
617
|
+
class: normalizeClass(unref(nsUpload).be("list", "item-preview")),
|
|
618
|
+
onClick: ($event) => _ctx.handlePreview(file)
|
|
619
|
+
}, [
|
|
620
|
+
createVNode(unref(ElIcon), {
|
|
621
|
+
class: normalizeClass(unref(nsIcon).m("zoom-in"))
|
|
622
|
+
}, {
|
|
623
|
+
default: withCtx(() => [
|
|
624
|
+
createVNode(unref(ZoomIn))
|
|
625
|
+
]),
|
|
626
|
+
_: 1
|
|
627
|
+
}, 8, ["class"])
|
|
628
|
+
], 10, ["onClick"]),
|
|
629
|
+
!unref(disabled) ? (openBlock(), createElementBlock("span", {
|
|
630
|
+
key: 0,
|
|
631
|
+
class: normalizeClass(unref(nsUpload).be("list", "item-delete")),
|
|
632
|
+
onClick: ($event) => handleRemove(file)
|
|
633
|
+
}, [
|
|
634
|
+
createVNode(unref(ElIcon), {
|
|
635
|
+
class: normalizeClass(unref(nsIcon).m("delete"))
|
|
636
|
+
}, {
|
|
637
|
+
default: withCtx(() => [
|
|
638
|
+
createVNode(unref(Delete))
|
|
639
|
+
]),
|
|
640
|
+
_: 1
|
|
641
|
+
}, 8, ["class"])
|
|
642
|
+
], 10, ["onClick"])) : createCommentVNode("v-if", true)
|
|
643
|
+
], 2)) : createCommentVNode("v-if", true)
|
|
644
|
+
])
|
|
645
|
+
], 42, ["tabindex", "aria-disabled", "onKeydown", "onFocus", "onBlur", "onClick"]);
|
|
646
|
+
}), 128)),
|
|
647
|
+
renderSlot(_ctx.$slots, "append")
|
|
648
|
+
]),
|
|
649
|
+
_: 3
|
|
650
|
+
}, 8, ["class", "name"]);
|
|
651
|
+
};
|
|
652
|
+
}
|
|
653
|
+
});
|
|
654
|
+
var UploadList = /* @__PURE__ */ _export_sfc(_sfc_main$4, [["__file", "upload-list.vue"]]);
|
|
655
|
+
|
|
656
|
+
const uploadDraggerProps = buildProps({
|
|
657
|
+
disabled: {
|
|
658
|
+
type: Boolean,
|
|
659
|
+
default: void 0
|
|
660
|
+
}
|
|
661
|
+
});
|
|
662
|
+
const uploadDraggerEmits = {
|
|
663
|
+
file: (file) => isArray(file)
|
|
664
|
+
};
|
|
665
|
+
|
|
666
|
+
const COMPONENT_NAME = "ElUploadDrag";
|
|
667
|
+
const __default__$2 = defineComponent({
|
|
668
|
+
name: COMPONENT_NAME
|
|
669
|
+
});
|
|
670
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
671
|
+
...__default__$2,
|
|
672
|
+
props: uploadDraggerProps,
|
|
673
|
+
emits: uploadDraggerEmits,
|
|
674
|
+
setup(__props, { emit }) {
|
|
675
|
+
const uploaderContext = inject(uploadContextKey);
|
|
676
|
+
if (!uploaderContext) {
|
|
677
|
+
throwError(COMPONENT_NAME, "usage: <el-upload><el-upload-dragger /></el-upload>");
|
|
678
|
+
}
|
|
679
|
+
const ns = useNamespace("upload");
|
|
680
|
+
const dragover = ref(false);
|
|
681
|
+
const disabled = useFormDisabled();
|
|
682
|
+
const onDrop = (e) => {
|
|
683
|
+
if (disabled.value)
|
|
684
|
+
return;
|
|
685
|
+
dragover.value = false;
|
|
686
|
+
e.stopPropagation();
|
|
687
|
+
const files = Array.from(e.dataTransfer.files);
|
|
688
|
+
const items = e.dataTransfer.items || [];
|
|
689
|
+
files.forEach((file, index) => {
|
|
690
|
+
var _a;
|
|
691
|
+
const item = items[index];
|
|
692
|
+
const entry = (_a = item == null ? void 0 : item.webkitGetAsEntry) == null ? void 0 : _a.call(item);
|
|
693
|
+
if (entry) {
|
|
694
|
+
file.isDirectory = entry.isDirectory;
|
|
695
|
+
}
|
|
696
|
+
});
|
|
697
|
+
emit("file", files);
|
|
698
|
+
};
|
|
699
|
+
const onDragover = () => {
|
|
700
|
+
if (!disabled.value)
|
|
701
|
+
dragover.value = true;
|
|
702
|
+
};
|
|
703
|
+
const onDragleave = (e) => {
|
|
704
|
+
if (!e.currentTarget.contains(e.relatedTarget))
|
|
705
|
+
dragover.value = false;
|
|
706
|
+
};
|
|
707
|
+
return (_ctx, _cache) => {
|
|
708
|
+
return openBlock(), createElementBlock("div", {
|
|
709
|
+
class: normalizeClass([unref(ns).b("dragger"), unref(ns).is("dragover", dragover.value)]),
|
|
710
|
+
onDrop: withModifiers(onDrop, ["prevent"]),
|
|
711
|
+
onDragover: withModifiers(onDragover, ["prevent"]),
|
|
712
|
+
onDragleave: withModifiers(onDragleave, ["prevent"])
|
|
713
|
+
}, [
|
|
714
|
+
renderSlot(_ctx.$slots, "default")
|
|
715
|
+
], 42, ["onDrop", "onDragover", "onDragleave"]);
|
|
716
|
+
};
|
|
717
|
+
}
|
|
718
|
+
});
|
|
719
|
+
var UploadDragger = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__file", "upload-dragger.vue"]]);
|
|
720
|
+
|
|
721
|
+
const uploadContentProps = buildProps({
|
|
722
|
+
...uploadBaseProps,
|
|
723
|
+
beforeUpload: {
|
|
724
|
+
type: definePropType(Function),
|
|
725
|
+
default: NOOP
|
|
726
|
+
},
|
|
727
|
+
onRemove: {
|
|
728
|
+
type: definePropType(Function),
|
|
729
|
+
default: NOOP
|
|
730
|
+
},
|
|
731
|
+
onStart: {
|
|
732
|
+
type: definePropType(Function),
|
|
733
|
+
default: NOOP
|
|
734
|
+
},
|
|
735
|
+
onSuccess: {
|
|
736
|
+
type: definePropType(Function),
|
|
737
|
+
default: NOOP
|
|
738
|
+
},
|
|
739
|
+
onProgress: {
|
|
740
|
+
type: definePropType(Function),
|
|
741
|
+
default: NOOP
|
|
742
|
+
},
|
|
743
|
+
onError: {
|
|
744
|
+
type: definePropType(Function),
|
|
745
|
+
default: NOOP
|
|
746
|
+
},
|
|
747
|
+
onExceed: {
|
|
748
|
+
type: definePropType(Function),
|
|
749
|
+
default: NOOP
|
|
750
|
+
}
|
|
751
|
+
});
|
|
752
|
+
|
|
753
|
+
const __default__$1 = defineComponent({
|
|
754
|
+
name: "ElUploadContent",
|
|
755
|
+
inheritAttrs: false
|
|
756
|
+
});
|
|
757
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
758
|
+
...__default__$1,
|
|
759
|
+
props: uploadContentProps,
|
|
760
|
+
setup(__props, { expose }) {
|
|
761
|
+
const props = __props;
|
|
762
|
+
const ns = useNamespace("upload");
|
|
763
|
+
const disabled = useFormDisabled();
|
|
764
|
+
const requests = shallowRef({});
|
|
765
|
+
const inputRef = shallowRef();
|
|
766
|
+
const uploadFiles = (files) => {
|
|
767
|
+
if (files.length === 0)
|
|
768
|
+
return;
|
|
769
|
+
const { autoUpload, limit, fileList, multiple, onStart, onExceed } = props;
|
|
770
|
+
if (limit && fileList.length + files.length > limit) {
|
|
771
|
+
onExceed(files, fileList);
|
|
772
|
+
return;
|
|
773
|
+
}
|
|
774
|
+
if (!multiple) {
|
|
775
|
+
files = files.slice(0, 1);
|
|
776
|
+
}
|
|
777
|
+
for (const file of files) {
|
|
778
|
+
const rawFile = file;
|
|
779
|
+
rawFile.uid = genFileId();
|
|
780
|
+
onStart(rawFile);
|
|
781
|
+
if (autoUpload)
|
|
782
|
+
upload(rawFile);
|
|
783
|
+
}
|
|
784
|
+
};
|
|
785
|
+
const upload = async (rawFile) => {
|
|
786
|
+
inputRef.value.value = "";
|
|
787
|
+
if (!props.beforeUpload) {
|
|
788
|
+
return doUpload(rawFile);
|
|
789
|
+
}
|
|
790
|
+
let hookResult;
|
|
791
|
+
let beforeData = {};
|
|
792
|
+
try {
|
|
793
|
+
const originData = props.data;
|
|
794
|
+
const beforeUploadPromise = props.beforeUpload(rawFile);
|
|
795
|
+
beforeData = isPlainObject(props.data) ? cloneDeep(props.data) : props.data;
|
|
796
|
+
hookResult = await beforeUploadPromise;
|
|
797
|
+
if (isPlainObject(props.data) && isEqual(originData, beforeData)) {
|
|
798
|
+
beforeData = cloneDeep(props.data);
|
|
799
|
+
}
|
|
800
|
+
} catch (e) {
|
|
801
|
+
hookResult = false;
|
|
802
|
+
}
|
|
803
|
+
if (hookResult === false) {
|
|
804
|
+
props.onRemove(rawFile);
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
let file = rawFile;
|
|
808
|
+
if (hookResult instanceof Blob) {
|
|
809
|
+
if (hookResult instanceof File) {
|
|
810
|
+
file = hookResult;
|
|
811
|
+
} else {
|
|
812
|
+
file = new File([hookResult], rawFile.name, {
|
|
813
|
+
type: rawFile.type
|
|
814
|
+
});
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
doUpload(Object.assign(file, {
|
|
818
|
+
uid: rawFile.uid
|
|
819
|
+
}), beforeData);
|
|
820
|
+
};
|
|
821
|
+
const resolveData = async (data, rawFile) => {
|
|
822
|
+
if (isFunction(data)) {
|
|
823
|
+
return data(rawFile);
|
|
824
|
+
}
|
|
825
|
+
return data;
|
|
826
|
+
};
|
|
827
|
+
const doUpload = async (rawFile, beforeData) => {
|
|
828
|
+
const {
|
|
829
|
+
headers,
|
|
830
|
+
data,
|
|
831
|
+
method,
|
|
832
|
+
withCredentials,
|
|
833
|
+
name: filename,
|
|
834
|
+
action,
|
|
835
|
+
onProgress,
|
|
836
|
+
onSuccess,
|
|
837
|
+
onError,
|
|
838
|
+
httpRequest
|
|
839
|
+
} = props;
|
|
840
|
+
try {
|
|
841
|
+
beforeData = await resolveData(beforeData != null ? beforeData : data, rawFile);
|
|
842
|
+
} catch (e) {
|
|
843
|
+
props.onRemove(rawFile);
|
|
844
|
+
return;
|
|
845
|
+
}
|
|
846
|
+
const { uid } = rawFile;
|
|
847
|
+
const options = {
|
|
848
|
+
headers: headers || {},
|
|
849
|
+
withCredentials,
|
|
850
|
+
file: rawFile,
|
|
851
|
+
data: beforeData,
|
|
852
|
+
method,
|
|
853
|
+
filename,
|
|
854
|
+
action,
|
|
855
|
+
onProgress: (evt) => {
|
|
856
|
+
onProgress(evt, rawFile);
|
|
857
|
+
},
|
|
858
|
+
onSuccess: (res) => {
|
|
859
|
+
onSuccess(res, rawFile);
|
|
860
|
+
delete requests.value[uid];
|
|
861
|
+
},
|
|
862
|
+
onError: (err) => {
|
|
863
|
+
onError(err, rawFile);
|
|
864
|
+
delete requests.value[uid];
|
|
865
|
+
}
|
|
866
|
+
};
|
|
867
|
+
const request = httpRequest(options);
|
|
868
|
+
requests.value[uid] = request;
|
|
869
|
+
if (request instanceof Promise) {
|
|
870
|
+
request.then(options.onSuccess, options.onError);
|
|
871
|
+
}
|
|
872
|
+
};
|
|
873
|
+
const handleChange = (e) => {
|
|
874
|
+
const files = e.target.files;
|
|
875
|
+
if (!files)
|
|
876
|
+
return;
|
|
877
|
+
uploadFiles(Array.from(files));
|
|
878
|
+
};
|
|
879
|
+
const handleClick = () => {
|
|
880
|
+
if (!disabled.value) {
|
|
881
|
+
inputRef.value.value = "";
|
|
882
|
+
inputRef.value.click();
|
|
883
|
+
}
|
|
884
|
+
};
|
|
885
|
+
const handleKeydown = () => {
|
|
886
|
+
handleClick();
|
|
887
|
+
};
|
|
888
|
+
const abort = (file) => {
|
|
889
|
+
const _reqs = entriesOf(requests.value).filter(file ? ([uid]) => String(file.uid) === uid : () => true);
|
|
890
|
+
_reqs.forEach(([uid, req]) => {
|
|
891
|
+
if (req instanceof XMLHttpRequest)
|
|
892
|
+
req.abort();
|
|
893
|
+
delete requests.value[uid];
|
|
894
|
+
});
|
|
895
|
+
};
|
|
896
|
+
expose({
|
|
897
|
+
abort,
|
|
898
|
+
upload
|
|
899
|
+
});
|
|
900
|
+
return (_ctx, _cache) => {
|
|
901
|
+
return openBlock(), createElementBlock("div", {
|
|
902
|
+
class: normalizeClass([
|
|
903
|
+
unref(ns).b(),
|
|
904
|
+
unref(ns).m(_ctx.listType),
|
|
905
|
+
unref(ns).is("drag", _ctx.drag),
|
|
906
|
+
unref(ns).is("disabled", unref(disabled))
|
|
907
|
+
]),
|
|
908
|
+
tabindex: unref(disabled) ? void 0 : 0,
|
|
909
|
+
"aria-disabled": unref(disabled),
|
|
910
|
+
role: "button",
|
|
911
|
+
onClick: handleClick,
|
|
912
|
+
onKeydown: withKeys(withModifiers(handleKeydown, ["self"]), ["enter", "space"])
|
|
913
|
+
}, [
|
|
914
|
+
_ctx.drag ? (openBlock(), createBlock(UploadDragger, {
|
|
915
|
+
key: 0,
|
|
916
|
+
disabled: unref(disabled),
|
|
917
|
+
onFile: uploadFiles
|
|
918
|
+
}, {
|
|
919
|
+
default: withCtx(() => [
|
|
920
|
+
renderSlot(_ctx.$slots, "default")
|
|
921
|
+
]),
|
|
922
|
+
_: 3
|
|
923
|
+
}, 8, ["disabled"])) : renderSlot(_ctx.$slots, "default", { key: 1 }),
|
|
924
|
+
createElementVNode("input", {
|
|
925
|
+
ref_key: "inputRef",
|
|
926
|
+
ref: inputRef,
|
|
927
|
+
class: normalizeClass(unref(ns).e("input")),
|
|
928
|
+
name: _ctx.name,
|
|
929
|
+
disabled: unref(disabled),
|
|
930
|
+
multiple: _ctx.multiple,
|
|
931
|
+
accept: _ctx.accept,
|
|
932
|
+
type: "file",
|
|
933
|
+
onChange: handleChange,
|
|
934
|
+
onClick: withModifiers(() => {
|
|
935
|
+
}, ["stop"])
|
|
936
|
+
}, null, 42, ["name", "disabled", "multiple", "accept", "onClick"])
|
|
937
|
+
], 42, ["tabindex", "aria-disabled", "onKeydown"]);
|
|
938
|
+
};
|
|
939
|
+
}
|
|
940
|
+
});
|
|
941
|
+
var UploadContent = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__file", "upload-content.vue"]]);
|
|
942
|
+
|
|
943
|
+
const SCOPE = "ElUpload";
|
|
944
|
+
const revokeFileObjectURL = (file) => {
|
|
945
|
+
var _a;
|
|
946
|
+
if ((_a = file.url) == null ? void 0 : _a.startsWith("blob:")) {
|
|
947
|
+
URL.revokeObjectURL(file.url);
|
|
948
|
+
}
|
|
949
|
+
};
|
|
950
|
+
const useHandlers = (props, uploadRef) => {
|
|
951
|
+
const uploadFiles = useVModel(props, "fileList", void 0, { passive: true });
|
|
952
|
+
const getFile = (rawFile) => uploadFiles.value.find((file) => file.uid === rawFile.uid);
|
|
953
|
+
function abort(file) {
|
|
954
|
+
var _a;
|
|
955
|
+
(_a = uploadRef.value) == null ? void 0 : _a.abort(file);
|
|
956
|
+
}
|
|
957
|
+
function clearFiles(states = ["ready", "uploading", "success", "fail"]) {
|
|
958
|
+
uploadFiles.value = uploadFiles.value.filter((row) => !states.includes(row.status));
|
|
959
|
+
}
|
|
960
|
+
function removeFile(file) {
|
|
961
|
+
uploadFiles.value = uploadFiles.value.filter((uploadFile) => uploadFile.uid !== file.uid);
|
|
962
|
+
}
|
|
963
|
+
const emitChange = (file) => {
|
|
964
|
+
nextTick(() => props.onChange(file, uploadFiles.value));
|
|
965
|
+
};
|
|
966
|
+
const handleError = (err, rawFile) => {
|
|
967
|
+
const file = getFile(rawFile);
|
|
968
|
+
if (!file)
|
|
969
|
+
return;
|
|
970
|
+
console.error(err);
|
|
971
|
+
file.status = "fail";
|
|
972
|
+
removeFile(file);
|
|
973
|
+
props.onError(err, file, uploadFiles.value);
|
|
974
|
+
emitChange(file);
|
|
975
|
+
};
|
|
976
|
+
const handleProgress = (evt, rawFile) => {
|
|
977
|
+
const file = getFile(rawFile);
|
|
978
|
+
if (!file)
|
|
979
|
+
return;
|
|
980
|
+
props.onProgress(evt, file, uploadFiles.value);
|
|
981
|
+
file.status = "uploading";
|
|
982
|
+
file.percentage = Math.round(evt.percent);
|
|
983
|
+
};
|
|
984
|
+
const handleSuccess = (response, rawFile) => {
|
|
985
|
+
const file = getFile(rawFile);
|
|
986
|
+
if (!file)
|
|
987
|
+
return;
|
|
988
|
+
file.status = "success";
|
|
989
|
+
file.response = response;
|
|
990
|
+
props.onSuccess(response, file, uploadFiles.value);
|
|
991
|
+
emitChange(file);
|
|
992
|
+
};
|
|
993
|
+
const handleStart = (file) => {
|
|
994
|
+
if (isNil(file.uid))
|
|
995
|
+
file.uid = genFileId();
|
|
996
|
+
const uploadFile = {
|
|
997
|
+
name: file.name,
|
|
998
|
+
percentage: 0,
|
|
999
|
+
status: "ready",
|
|
1000
|
+
size: file.size,
|
|
1001
|
+
raw: file,
|
|
1002
|
+
uid: file.uid
|
|
1003
|
+
};
|
|
1004
|
+
if (props.listType === "picture-card" || props.listType === "picture") {
|
|
1005
|
+
try {
|
|
1006
|
+
uploadFile.url = URL.createObjectURL(file);
|
|
1007
|
+
} catch (err) {
|
|
1008
|
+
debugWarn(SCOPE, err.message);
|
|
1009
|
+
props.onError(err, uploadFile, uploadFiles.value);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
uploadFiles.value = [...uploadFiles.value, uploadFile];
|
|
1013
|
+
emitChange(uploadFile);
|
|
1014
|
+
};
|
|
1015
|
+
const handleRemove = async (file) => {
|
|
1016
|
+
const uploadFile = file instanceof File ? getFile(file) : file;
|
|
1017
|
+
if (!uploadFile)
|
|
1018
|
+
throwError(SCOPE, "file to be removed not found");
|
|
1019
|
+
const doRemove = (file2) => {
|
|
1020
|
+
abort(file2);
|
|
1021
|
+
removeFile(file2);
|
|
1022
|
+
props.onRemove(file2, uploadFiles.value);
|
|
1023
|
+
revokeFileObjectURL(file2);
|
|
1024
|
+
};
|
|
1025
|
+
if (props.beforeRemove) {
|
|
1026
|
+
const before = await props.beforeRemove(uploadFile, uploadFiles.value);
|
|
1027
|
+
if (before !== false)
|
|
1028
|
+
doRemove(uploadFile);
|
|
1029
|
+
} else {
|
|
1030
|
+
doRemove(uploadFile);
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
function submit() {
|
|
1034
|
+
uploadFiles.value.filter(({ status }) => status === "ready").forEach(({ raw }) => {
|
|
1035
|
+
var _a;
|
|
1036
|
+
return raw && ((_a = uploadRef.value) == null ? void 0 : _a.upload(raw));
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
watch(() => props.listType, (val) => {
|
|
1040
|
+
if (val !== "picture-card" && val !== "picture") {
|
|
1041
|
+
return;
|
|
1042
|
+
}
|
|
1043
|
+
uploadFiles.value = uploadFiles.value.map((file) => {
|
|
1044
|
+
const { raw, url } = file;
|
|
1045
|
+
if (!url && raw) {
|
|
1046
|
+
try {
|
|
1047
|
+
file.url = URL.createObjectURL(raw);
|
|
1048
|
+
} catch (err) {
|
|
1049
|
+
props.onError(err, file, uploadFiles.value);
|
|
1050
|
+
}
|
|
1051
|
+
}
|
|
1052
|
+
return file;
|
|
1053
|
+
});
|
|
1054
|
+
});
|
|
1055
|
+
watch(uploadFiles, (files) => {
|
|
1056
|
+
for (const file of files) {
|
|
1057
|
+
file.uid || (file.uid = genFileId());
|
|
1058
|
+
file.status || (file.status = "success");
|
|
1059
|
+
}
|
|
1060
|
+
}, { immediate: true, deep: true });
|
|
1061
|
+
return {
|
|
1062
|
+
uploadFiles,
|
|
1063
|
+
abort,
|
|
1064
|
+
clearFiles,
|
|
1065
|
+
handleError,
|
|
1066
|
+
handleProgress,
|
|
1067
|
+
handleStart,
|
|
1068
|
+
handleSuccess,
|
|
1069
|
+
handleRemove,
|
|
1070
|
+
submit,
|
|
1071
|
+
revokeFileObjectURL
|
|
1072
|
+
};
|
|
1073
|
+
};
|
|
1074
|
+
|
|
1075
|
+
const __default__ = defineComponent({
|
|
1076
|
+
name: "ElUpload"
|
|
1077
|
+
});
|
|
1078
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
1079
|
+
...__default__,
|
|
1080
|
+
props: uploadProps,
|
|
1081
|
+
setup(__props, { expose }) {
|
|
1082
|
+
const props = __props;
|
|
1083
|
+
const disabled = useFormDisabled();
|
|
1084
|
+
const uploadRef = shallowRef();
|
|
1085
|
+
const {
|
|
1086
|
+
abort,
|
|
1087
|
+
submit,
|
|
1088
|
+
clearFiles,
|
|
1089
|
+
uploadFiles,
|
|
1090
|
+
handleStart,
|
|
1091
|
+
handleError,
|
|
1092
|
+
handleRemove,
|
|
1093
|
+
handleSuccess,
|
|
1094
|
+
handleProgress,
|
|
1095
|
+
revokeFileObjectURL
|
|
1096
|
+
} = useHandlers(props, uploadRef);
|
|
1097
|
+
const isPictureCard = computed(() => props.listType === "picture-card");
|
|
1098
|
+
const uploadContentProps = computed(() => ({
|
|
1099
|
+
...props,
|
|
1100
|
+
fileList: uploadFiles.value,
|
|
1101
|
+
onStart: handleStart,
|
|
1102
|
+
onProgress: handleProgress,
|
|
1103
|
+
onSuccess: handleSuccess,
|
|
1104
|
+
onError: handleError,
|
|
1105
|
+
onRemove: handleRemove
|
|
1106
|
+
}));
|
|
1107
|
+
onBeforeUnmount(() => {
|
|
1108
|
+
uploadFiles.value.forEach(revokeFileObjectURL);
|
|
1109
|
+
});
|
|
1110
|
+
provide(uploadContextKey, {
|
|
1111
|
+
accept: toRef(props, "accept")
|
|
1112
|
+
});
|
|
1113
|
+
expose({
|
|
1114
|
+
abort,
|
|
1115
|
+
submit,
|
|
1116
|
+
clearFiles,
|
|
1117
|
+
handleStart,
|
|
1118
|
+
handleRemove
|
|
1119
|
+
});
|
|
1120
|
+
return (_ctx, _cache) => {
|
|
1121
|
+
return openBlock(), createElementBlock("div", null, [
|
|
1122
|
+
unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
|
|
1123
|
+
key: 0,
|
|
1124
|
+
disabled: unref(disabled),
|
|
1125
|
+
"list-type": _ctx.listType,
|
|
1126
|
+
files: unref(uploadFiles),
|
|
1127
|
+
crossorigin: _ctx.crossorigin,
|
|
1128
|
+
"handle-preview": _ctx.onPreview,
|
|
1129
|
+
onRemove: unref(handleRemove)
|
|
1130
|
+
}, createSlots({
|
|
1131
|
+
append: withCtx(() => [
|
|
1132
|
+
createVNode(UploadContent, mergeProps({
|
|
1133
|
+
ref_key: "uploadRef",
|
|
1134
|
+
ref: uploadRef
|
|
1135
|
+
}, unref(uploadContentProps)), {
|
|
1136
|
+
default: withCtx(() => [
|
|
1137
|
+
_ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
|
|
1138
|
+
!_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
|
|
1139
|
+
]),
|
|
1140
|
+
_: 3
|
|
1141
|
+
}, 16)
|
|
1142
|
+
]),
|
|
1143
|
+
_: 2
|
|
1144
|
+
}, [
|
|
1145
|
+
_ctx.$slots.file ? {
|
|
1146
|
+
name: "default",
|
|
1147
|
+
fn: withCtx(({ file, index }) => [
|
|
1148
|
+
renderSlot(_ctx.$slots, "file", {
|
|
1149
|
+
file,
|
|
1150
|
+
index
|
|
1151
|
+
})
|
|
1152
|
+
])
|
|
1153
|
+
} : void 0
|
|
1154
|
+
]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true),
|
|
1155
|
+
!unref(isPictureCard) || unref(isPictureCard) && !_ctx.showFileList ? (openBlock(), createBlock(UploadContent, mergeProps({
|
|
1156
|
+
key: 1,
|
|
1157
|
+
ref_key: "uploadRef",
|
|
1158
|
+
ref: uploadRef
|
|
1159
|
+
}, unref(uploadContentProps)), {
|
|
1160
|
+
default: withCtx(() => [
|
|
1161
|
+
_ctx.$slots.trigger ? renderSlot(_ctx.$slots, "trigger", { key: 0 }) : createCommentVNode("v-if", true),
|
|
1162
|
+
!_ctx.$slots.trigger && _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 1 }) : createCommentVNode("v-if", true)
|
|
1163
|
+
]),
|
|
1164
|
+
_: 3
|
|
1165
|
+
}, 16)) : createCommentVNode("v-if", true),
|
|
1166
|
+
_ctx.$slots.trigger ? renderSlot(_ctx.$slots, "default", { key: 2 }) : createCommentVNode("v-if", true),
|
|
1167
|
+
renderSlot(_ctx.$slots, "tip"),
|
|
1168
|
+
!unref(isPictureCard) && _ctx.showFileList ? (openBlock(), createBlock(UploadList, {
|
|
1169
|
+
key: 3,
|
|
1170
|
+
disabled: unref(disabled),
|
|
1171
|
+
"list-type": _ctx.listType,
|
|
1172
|
+
files: unref(uploadFiles),
|
|
1173
|
+
crossorigin: _ctx.crossorigin,
|
|
1174
|
+
"handle-preview": _ctx.onPreview,
|
|
1175
|
+
onRemove: unref(handleRemove)
|
|
1176
|
+
}, createSlots({
|
|
1177
|
+
_: 2
|
|
1178
|
+
}, [
|
|
1179
|
+
_ctx.$slots.file ? {
|
|
1180
|
+
name: "default",
|
|
1181
|
+
fn: withCtx(({ file, index }) => [
|
|
1182
|
+
renderSlot(_ctx.$slots, "file", {
|
|
1183
|
+
file,
|
|
1184
|
+
index
|
|
1185
|
+
})
|
|
1186
|
+
])
|
|
1187
|
+
} : void 0
|
|
1188
|
+
]), 1032, ["disabled", "list-type", "files", "crossorigin", "handle-preview", "onRemove"])) : createCommentVNode("v-if", true)
|
|
1189
|
+
]);
|
|
1190
|
+
};
|
|
1191
|
+
}
|
|
1192
|
+
});
|
|
1193
|
+
var Upload = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["__file", "upload.vue"]]);
|
|
1194
|
+
|
|
1195
|
+
const ElUpload = withInstall(Upload);
|
|
1196
|
+
|
|
1197
|
+
const _hoisted_1 = { class: "el-upload-list__item" };
|
|
1198
|
+
const _hoisted_2 = ["src"];
|
|
1199
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
1200
|
+
__name: "dialog-upload-images",
|
|
1201
|
+
props: {
|
|
1202
|
+
modelValue: {},
|
|
1203
|
+
visible: { type: Boolean },
|
|
1204
|
+
destroyOnClose: { type: Boolean, default: false },
|
|
1205
|
+
limit: { default: 5 },
|
|
1206
|
+
maxSize: { default: 2 * 1024 * 1024 },
|
|
1207
|
+
httpRequest: {},
|
|
1208
|
+
beforeUpload: { type: Function, default: () => true },
|
|
1209
|
+
beforeRemove: { type: Function, default: () => true }
|
|
1210
|
+
},
|
|
1211
|
+
emits: ["update:visible", "update:modelValue", "error", "close"],
|
|
1212
|
+
setup(__props, { emit: __emit }) {
|
|
1213
|
+
const props = __props;
|
|
1214
|
+
const emits = __emit;
|
|
1215
|
+
const loading = ref(false);
|
|
1216
|
+
const imgList = shallowRef(props.modelValue);
|
|
1217
|
+
const dialogVisible = computed({
|
|
1218
|
+
get: () => props.visible,
|
|
1219
|
+
set: (val) => {
|
|
1220
|
+
emits("update:visible", val);
|
|
1221
|
+
if (!val) {
|
|
1222
|
+
emits("close");
|
|
1223
|
+
}
|
|
1224
|
+
}
|
|
1225
|
+
});
|
|
1226
|
+
function getImgUrl(file) {
|
|
1227
|
+
if (!defaultWindow) {
|
|
1228
|
+
return "";
|
|
1229
|
+
}
|
|
1230
|
+
const data = file;
|
|
1231
|
+
if (data.url) {
|
|
1232
|
+
return data.url;
|
|
1233
|
+
}
|
|
1234
|
+
return defaultWindow.URL.createObjectURL(data);
|
|
1235
|
+
}
|
|
1236
|
+
function handleConfirm() {
|
|
1237
|
+
emits("update:modelValue", imgList.value);
|
|
1238
|
+
dialogVisible.value = false;
|
|
1239
|
+
}
|
|
1240
|
+
async function handleHttpRequest({ file }) {
|
|
1241
|
+
const myUploadFile = await props.httpRequest(file) || file;
|
|
1242
|
+
imgList.value = [...imgList.value, myUploadFile];
|
|
1243
|
+
loading.value = false;
|
|
1244
|
+
}
|
|
1245
|
+
function handleBeforeUpload(file) {
|
|
1246
|
+
if (file.size > props.maxSize) {
|
|
1247
|
+
const message = `文件大小不能超过${props.maxSize / 1024 / 1024}M`;
|
|
1248
|
+
emits("error", message);
|
|
1249
|
+
return false;
|
|
1250
|
+
}
|
|
1251
|
+
if (props.beforeUpload) {
|
|
1252
|
+
if (props.beforeUpload(file)) {
|
|
1253
|
+
loading.value = true;
|
|
1254
|
+
return true;
|
|
1255
|
+
}
|
|
1256
|
+
return false;
|
|
1257
|
+
}
|
|
1258
|
+
loading.value = true;
|
|
1259
|
+
return true;
|
|
1260
|
+
}
|
|
1261
|
+
async function handleBeforeRemove(file, fileList) {
|
|
1262
|
+
if (props.beforeRemove) {
|
|
1263
|
+
loading.value = true;
|
|
1264
|
+
const result = await props.beforeRemove(file, fileList);
|
|
1265
|
+
loading.value = false;
|
|
1266
|
+
return result;
|
|
1267
|
+
}
|
|
1268
|
+
return true;
|
|
1269
|
+
}
|
|
1270
|
+
async function handleOnRemove(file) {
|
|
1271
|
+
const result = await handleBeforeRemove(file, imgList.value);
|
|
1272
|
+
if (!result) {
|
|
1273
|
+
return;
|
|
1274
|
+
}
|
|
1275
|
+
const index = imgList.value.findIndex((item) => item === file);
|
|
1276
|
+
imgList.value.splice(index, 1);
|
|
1277
|
+
imgList.value = [...imgList.value];
|
|
1278
|
+
}
|
|
1279
|
+
function handleOnExceed() {
|
|
1280
|
+
const message = `文件数量不能超过 ${props.limit} 个`;
|
|
1281
|
+
emits("error", message);
|
|
1282
|
+
}
|
|
1283
|
+
function handleOnPreview(file) {
|
|
1284
|
+
defaultWindow && defaultWindow.open(getImgUrl(file));
|
|
1285
|
+
}
|
|
1286
|
+
return (_ctx, _cache) => {
|
|
1287
|
+
const _component_ElUpload = ElUpload;
|
|
1288
|
+
const _component_ElButton = ElButton;
|
|
1289
|
+
const _directive_loading = vLoading;
|
|
1290
|
+
return openBlock(), createBlock(Component$1, mergeProps({
|
|
1291
|
+
modelValue: unref(dialogVisible),
|
|
1292
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => isRef(dialogVisible) ? dialogVisible.value = $event : null),
|
|
1293
|
+
title: "上传图片",
|
|
1294
|
+
"close-on-click-modal": false,
|
|
1295
|
+
class: _ctx.$style.dialog,
|
|
1296
|
+
width: 862,
|
|
1297
|
+
"show-close": false,
|
|
1298
|
+
"destroy-on-close": __props.destroyOnClose,
|
|
1299
|
+
"append-to-body": ""
|
|
1300
|
+
}, _ctx.$attrs), {
|
|
1301
|
+
footer: withCtx(() => [
|
|
1302
|
+
createVNode(_component_ElButton, {
|
|
1303
|
+
type: "primary",
|
|
1304
|
+
loading: unref(loading),
|
|
1305
|
+
onClick: handleConfirm
|
|
1306
|
+
}, {
|
|
1307
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [
|
|
1308
|
+
createTextVNode("确 定", -1)
|
|
1309
|
+
])]),
|
|
1310
|
+
_: 1
|
|
1311
|
+
}, 8, ["loading"])
|
|
1312
|
+
]),
|
|
1313
|
+
default: withCtx(() => [
|
|
1314
|
+
createVNode(unref(Draggable), {
|
|
1315
|
+
modelValue: unref(imgList),
|
|
1316
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(imgList) ? imgList.value = $event : null),
|
|
1317
|
+
"item-key": "uid",
|
|
1318
|
+
class: normalizeClass(["el-upload-list--picture-card", [_ctx.$style.draggable]])
|
|
1319
|
+
}, {
|
|
1320
|
+
header: withCtx(() => [
|
|
1321
|
+
withDirectives((openBlock(), createBlock(_component_ElUpload, {
|
|
1322
|
+
multiple: "",
|
|
1323
|
+
action: "",
|
|
1324
|
+
"file-list": __props.modelValue,
|
|
1325
|
+
"show-file-list": false,
|
|
1326
|
+
"http-request": handleHttpRequest,
|
|
1327
|
+
"before-upload": handleBeforeUpload,
|
|
1328
|
+
accept: ".jpg,.jpeg,.png",
|
|
1329
|
+
class: normalizeClass(_ctx.$style.upload),
|
|
1330
|
+
limit: __props.limit,
|
|
1331
|
+
"on-exceed": handleOnExceed
|
|
1332
|
+
}, {
|
|
1333
|
+
default: withCtx(() => [
|
|
1334
|
+
createVNode(Component$2, { name: "Plus" })
|
|
1335
|
+
]),
|
|
1336
|
+
_: 1
|
|
1337
|
+
}, 8, ["file-list", "class", "limit"])), [
|
|
1338
|
+
[_directive_loading, unref(loading)]
|
|
1339
|
+
])
|
|
1340
|
+
]),
|
|
1341
|
+
item: withCtx(({ element }) => [
|
|
1342
|
+
createElementVNode("div", _hoisted_1, [
|
|
1343
|
+
createElementVNode("img", {
|
|
1344
|
+
class: "el-upload-list__item-thumbnail",
|
|
1345
|
+
src: getImgUrl(element)
|
|
1346
|
+
}, null, 8, _hoisted_2),
|
|
1347
|
+
createElementVNode("span", {
|
|
1348
|
+
class: normalizeClass(["el-upload-list__item-actions", [_ctx.$style.opration]])
|
|
1349
|
+
}, [
|
|
1350
|
+
createVNode(Component$2, {
|
|
1351
|
+
name: "ZoomIn",
|
|
1352
|
+
onClick: ($event) => handleOnPreview(element)
|
|
1353
|
+
}, null, 8, ["onClick"]),
|
|
1354
|
+
createVNode(Component$2, {
|
|
1355
|
+
name: "Delete",
|
|
1356
|
+
onClick: ($event) => handleOnRemove(element)
|
|
1357
|
+
}, null, 8, ["onClick"])
|
|
1358
|
+
], 2)
|
|
1359
|
+
])
|
|
1360
|
+
]),
|
|
1361
|
+
_: 1
|
|
1362
|
+
}, 8, ["modelValue", "class"])
|
|
1363
|
+
]),
|
|
1364
|
+
_: 1
|
|
1365
|
+
}, 16, ["modelValue", "class", "destroy-on-close"]);
|
|
1366
|
+
};
|
|
1367
|
+
}
|
|
1368
|
+
});
|
|
1369
|
+
|
|
1370
|
+
/* unplugin-vue-components disabled */const dialog = "_dialog_1gadx_1";
|
|
1371
|
+
const upload = "_upload_1gadx_9";
|
|
1372
|
+
const opration = "_opration_1gadx_35";
|
|
1373
|
+
const draggable = "_draggable_1gadx_48";
|
|
1374
|
+
const style0 = {
|
|
1375
|
+
dialog: dialog,
|
|
1376
|
+
upload: upload,
|
|
1377
|
+
opration: opration,
|
|
1378
|
+
draggable: draggable
|
|
1379
|
+
};
|
|
1380
|
+
|
|
1381
|
+
const cssModules = {
|
|
1382
|
+
"$style": style0
|
|
1383
|
+
};
|
|
1384
|
+
const Component = /* @__PURE__ */ _export_sfc$1(_sfc_main, [["__cssModules", cssModules]]);
|
|
1385
|
+
|
|
1386
|
+
const __vite_glob_0_12 = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
1387
|
+
__proto__: null,
|
|
1388
|
+
default: Component
|
|
1389
|
+
}, Symbol.toStringTag, { value: 'Module' }));
|
|
1390
|
+
|
|
1391
|
+
export { Component as C, __vite_glob_0_12 as _ };
|