vxe-pc-ui 4.10.23 → 4.10.25
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/es/icon/style.css +1 -1
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/log.js +1 -1
- package/es/upload/src/upload.js +256 -203
- package/es/upload/style.css +1 -1
- package/es/upload/style.min.css +1 -1
- package/es/vxe-upload/style.css +1 -1
- package/es/vxe-upload/style.min.css +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +108 -16
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/style.min.css +1 -1
- package/lib/ui/index.js +1 -1
- package/lib/ui/index.min.js +1 -1
- package/lib/ui/src/log.js +1 -1
- package/lib/ui/src/log.min.js +1 -1
- package/lib/upload/src/upload.js +106 -14
- package/lib/upload/src/upload.min.js +1 -1
- package/lib/upload/style/style.css +1 -1
- package/lib/upload/style/style.min.css +1 -1
- package/lib/vxe-upload/style/style.css +1 -1
- package/lib/vxe-upload/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/upload/src/upload.ts +275 -223
- package/styles/components/upload.scss +1 -1
- package/types/components/upload.d.ts +56 -5
- /package/es/icon/{iconfont.1762996548923.ttf → iconfont.1763018326353.ttf} +0 -0
- /package/es/icon/{iconfont.1762996548923.woff → iconfont.1763018326353.woff} +0 -0
- /package/es/icon/{iconfont.1762996548923.woff2 → iconfont.1763018326353.woff2} +0 -0
- /package/es/{iconfont.1762996548923.ttf → iconfont.1763018326353.ttf} +0 -0
- /package/es/{iconfont.1762996548923.woff → iconfont.1763018326353.woff} +0 -0
- /package/es/{iconfont.1762996548923.woff2 → iconfont.1763018326353.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1762996548923.ttf → iconfont.1763018326353.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1762996548923.woff → iconfont.1763018326353.woff} +0 -0
- /package/lib/icon/style/{iconfont.1762996548923.woff2 → iconfont.1763018326353.woff2} +0 -0
- /package/lib/{iconfont.1762996548923.ttf → iconfont.1763018326353.ttf} +0 -0
- /package/lib/{iconfont.1762996548923.woff → iconfont.1763018326353.woff} +0 -0
- /package/lib/{iconfont.1762996548923.woff2 → iconfont.1763018326353.woff2} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ref, h, reactive, watch, computed, TransitionGroup, PropType, inject, onUnmounted, onMounted } from 'vue'
|
|
1
|
+
import { ref, h, reactive, watch, computed, TransitionGroup, PropType, inject, onUnmounted, onMounted, nextTick } from 'vue'
|
|
2
2
|
import { defineVxeComponent } from '../../ui/src/comp'
|
|
3
3
|
import XEUtils from 'xe-utils'
|
|
4
4
|
import { VxeUI, getConfig, getI18n, getIcon, useSize, createEvent, globalEvents, renderEmptyElement } from '../../ui'
|
|
@@ -8,7 +8,7 @@ import { initTpImg, getTpImg, getEventTargetNode, toCssUnit } from '../../ui/src
|
|
|
8
8
|
import { readLocalFile } from './util'
|
|
9
9
|
import VxeButtonComponent from '../../button/src/button'
|
|
10
10
|
|
|
11
|
-
import type { VxeUploadDefines, VxeUploadPropTypes, UploadReactData, UploadInternalData, UploadPrivateMethods, UploadMethods, VxeUploadEmits, UploadPrivateRef, VxeUploadPrivateComputed, VxeUploadConstructor, VxeUploadPrivateMethods, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, ValueOf } from '../../../types'
|
|
11
|
+
import type { VxeUploadDefines, VxeUploadPropTypes, UploadReactData, UploadInternalData, UploadPrivateMethods, UploadMethods, VxeUploadEmits, UploadPrivateRef, VxeUploadPrivateComputed, VxeUploadConstructor, VxeUploadPrivateMethods, VxeFormDefines, VxeFormConstructor, VxeFormPrivateMethods, ValueOf, VxeComponentEventParams } from '../../../types'
|
|
12
12
|
import type { VxeTableConstructor, VxeTablePrivateMethods } from '../../../types/components/table'
|
|
13
13
|
|
|
14
14
|
export default defineVxeComponent({
|
|
@@ -194,7 +194,8 @@ export default defineVxeComponent({
|
|
|
194
194
|
'download-fail',
|
|
195
195
|
'upload-success',
|
|
196
196
|
'upload-error',
|
|
197
|
-
'sort-dragend'
|
|
197
|
+
'sort-dragend',
|
|
198
|
+
'more-visible'
|
|
198
199
|
] as VxeUploadEmits,
|
|
199
200
|
setup (props, context) {
|
|
200
201
|
const { emit, slots } = context
|
|
@@ -224,6 +225,7 @@ export default defineVxeComponent({
|
|
|
224
225
|
})
|
|
225
226
|
|
|
226
227
|
const internalData: UploadInternalData = {
|
|
228
|
+
moreId: XEUtils.uniqueId('upload'),
|
|
227
229
|
imagePreviewTypes: ['jpg', 'jpeg', 'png', 'gif'],
|
|
228
230
|
prevDragIndex: -1
|
|
229
231
|
// prevDragPos: ''
|
|
@@ -959,12 +961,14 @@ export default defineVxeComponent({
|
|
|
959
961
|
return files
|
|
960
962
|
}
|
|
961
963
|
|
|
962
|
-
const handleMoreEvent = () => {
|
|
964
|
+
const handleMoreEvent = (evntParams: VxeComponentEventParams) => {
|
|
963
965
|
const formReadonly = computeFormReadonly.value
|
|
964
966
|
const isImage = computeIsImage.value
|
|
965
967
|
|
|
968
|
+
const evnt = evntParams.$event
|
|
966
969
|
if (VxeUI.modal) {
|
|
967
970
|
VxeUI.modal.open({
|
|
971
|
+
id: internalData.moreId,
|
|
968
972
|
title: formReadonly ? getI18n('vxe.upload.morePopup.readTitle') : getI18n(`vxe.upload.morePopup.${isImage ? 'imageTitle' : 'fileTitle'}`),
|
|
969
973
|
width: 660,
|
|
970
974
|
height: 500,
|
|
@@ -978,6 +982,7 @@ export default defineVxeComponent({
|
|
|
978
982
|
const { isActivated, isDragMove, isDragUploadStatus, dragIndex } = reactData
|
|
979
983
|
const { fileList } = reactData
|
|
980
984
|
const isDisabled = computeIsDisabled.value
|
|
985
|
+
const moreContSlot = slots.moreContent || slots['more-content']
|
|
981
986
|
|
|
982
987
|
const ons: Record<string, any> = {}
|
|
983
988
|
if (dragToUpload && dragIndex === -1) {
|
|
@@ -996,58 +1001,66 @@ export default defineVxeComponent({
|
|
|
996
1001
|
'is--drag': isDragUploadStatus
|
|
997
1002
|
}],
|
|
998
1003
|
...ons
|
|
999
|
-
},
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1004
|
+
}, moreContSlot
|
|
1005
|
+
? getSlotVNs(moreContSlot({ options: fileList }))
|
|
1006
|
+
: [
|
|
1007
|
+
isImage
|
|
1008
|
+
? (
|
|
1009
|
+
dragSort
|
|
1010
|
+
? h(TransitionGroup, {
|
|
1011
|
+
name: `vxe-upload--drag-list${isDragMove ? '' : '-disabled'}`,
|
|
1012
|
+
tag: 'div',
|
|
1013
|
+
class: 'vxe-upload--image-more-list'
|
|
1014
|
+
}, {
|
|
1015
|
+
default: () => renderImageItemList(fileList, true).concat(renderImageAction(true))
|
|
1016
|
+
})
|
|
1017
|
+
: h('div', {
|
|
1018
|
+
class: 'vxe-upload--image-more-list'
|
|
1019
|
+
}, renderImageItemList(fileList, true).concat(renderImageAction(true)))
|
|
1020
|
+
)
|
|
1021
|
+
: h('div', {
|
|
1022
|
+
class: 'vxe-upload--file-more-list'
|
|
1023
|
+
}, [
|
|
1024
|
+
renderFileAction(true),
|
|
1025
|
+
dragSort
|
|
1026
|
+
? h(TransitionGroup, {
|
|
1027
|
+
name: `vxe-upload--drag-list${isDragMove ? '' : '-disabled'}`,
|
|
1028
|
+
tag: 'div',
|
|
1029
|
+
class: 'vxe-upload--file-list'
|
|
1030
|
+
}, {
|
|
1031
|
+
default: () => renderFileItemList(fileList, false)
|
|
1032
|
+
})
|
|
1033
|
+
: h('div', {
|
|
1034
|
+
class: 'vxe-upload--file-list'
|
|
1035
|
+
}, renderFileItemList(fileList, true))
|
|
1036
|
+
]),
|
|
1018
1037
|
dragSort
|
|
1019
|
-
? h(
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
class: 'vxe-upload--file-list'
|
|
1023
|
-
}, {
|
|
1024
|
-
default: () => renderFileItemList(fileList, false)
|
|
1038
|
+
? h('div', {
|
|
1039
|
+
ref: refModalDragLineElem,
|
|
1040
|
+
class: 'vxe-upload--drag-line'
|
|
1025
1041
|
})
|
|
1026
|
-
:
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
class: 'vxe-upload--drag-line'
|
|
1034
|
-
})
|
|
1035
|
-
: renderEmptyElement($xeUpload),
|
|
1036
|
-
isDragUploadStatus
|
|
1037
|
-
? h('div', {
|
|
1038
|
-
class: 'vxe-upload--drag-placeholder'
|
|
1039
|
-
}, getI18n('vxe.upload.dragPlaceholder'))
|
|
1040
|
-
: renderEmptyElement($xeUpload)
|
|
1041
|
-
])
|
|
1042
|
+
: renderEmptyElement($xeUpload),
|
|
1043
|
+
isDragUploadStatus
|
|
1044
|
+
? h('div', {
|
|
1045
|
+
class: 'vxe-upload--drag-placeholder'
|
|
1046
|
+
}, getI18n('vxe.upload.dragPlaceholder'))
|
|
1047
|
+
: renderEmptyElement($xeUpload)
|
|
1048
|
+
])
|
|
1042
1049
|
}
|
|
1043
1050
|
},
|
|
1044
1051
|
onShow () {
|
|
1045
1052
|
reactData.showMorePopup = true
|
|
1046
1053
|
},
|
|
1047
|
-
onHide () {
|
|
1054
|
+
onHide ({ $event }) {
|
|
1048
1055
|
reactData.showMorePopup = false
|
|
1056
|
+
if ($event) {
|
|
1057
|
+
dispatchEvent('more-visible', { visible: false }, $event)
|
|
1058
|
+
}
|
|
1049
1059
|
}
|
|
1050
1060
|
})
|
|
1061
|
+
if (evnt) {
|
|
1062
|
+
dispatchEvent('more-visible', { visible: true }, evnt)
|
|
1063
|
+
}
|
|
1051
1064
|
}
|
|
1052
1065
|
}
|
|
1053
1066
|
|
|
@@ -1242,6 +1255,23 @@ export default defineVxeComponent({
|
|
|
1242
1255
|
return Promise.all(allPendingList.splice(0, msNum).map(handleSubmit)).then(() => {
|
|
1243
1256
|
// 完成
|
|
1244
1257
|
})
|
|
1258
|
+
},
|
|
1259
|
+
getMoreVisible () {
|
|
1260
|
+
return reactData.showMorePopup
|
|
1261
|
+
},
|
|
1262
|
+
openMore () {
|
|
1263
|
+
handleMoreEvent({ $event: new Event('click') })
|
|
1264
|
+
return nextTick()
|
|
1265
|
+
},
|
|
1266
|
+
openMoreByEvent (evnt) {
|
|
1267
|
+
handleMoreEvent({ $event: evnt })
|
|
1268
|
+
return nextTick()
|
|
1269
|
+
},
|
|
1270
|
+
closeMore () {
|
|
1271
|
+
if (VxeUI.modal) {
|
|
1272
|
+
VxeUI.modal.close(internalData.moreId)
|
|
1273
|
+
}
|
|
1274
|
+
return nextTick()
|
|
1245
1275
|
}
|
|
1246
1276
|
}
|
|
1247
1277
|
|
|
@@ -1252,12 +1282,15 @@ export default defineVxeComponent({
|
|
|
1252
1282
|
|
|
1253
1283
|
const renderFileItemList = (currList: VxeUploadDefines.FileObjItem[], isMoreView: boolean) => {
|
|
1254
1284
|
const { showRemoveButton, showDownloadButton, showProgress, progressText, showPreview, showErrorStatus, dragSort, autoSubmit, showSubmitButton } = props
|
|
1255
|
-
const { fileCacheMaps } = reactData
|
|
1285
|
+
const { fileList, fileCacheMaps } = reactData
|
|
1256
1286
|
const isDisabled = computeIsDisabled.value
|
|
1257
1287
|
const formReadonly = computeFormReadonly.value
|
|
1258
1288
|
const nameProp = computeNameProp.value
|
|
1259
1289
|
const typeProp = computeTypeProp.value
|
|
1290
|
+
const optionSlot = slots.option
|
|
1291
|
+
const actionSlot = slots.action
|
|
1260
1292
|
const cornerSlot = slots.corner
|
|
1293
|
+
const nameSlot = slots.name
|
|
1261
1294
|
|
|
1262
1295
|
const ons: Record<string, any> = {}
|
|
1263
1296
|
if (dragSort && currList.length > 1) {
|
|
@@ -1289,91 +1322,96 @@ export default defineVxeComponent({
|
|
|
1289
1322
|
fileid: fileKey,
|
|
1290
1323
|
draggable: dragSort ? true : null,
|
|
1291
1324
|
...ons
|
|
1292
|
-
},
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
class: getIcon()[`UPLOAD_FILE_TYPE_${`${item[typeProp]}`.toLocaleUpperCase() as 'DEFAULT'}`] || getIcon().UPLOAD_FILE_TYPE_DEFAULT
|
|
1298
|
-
})
|
|
1299
|
-
]),
|
|
1300
|
-
h('div', {
|
|
1301
|
-
class: 'vxe-upload--file-item-name',
|
|
1302
|
-
title: fileName,
|
|
1303
|
-
onClick (evnt) {
|
|
1304
|
-
if (!isLoading && !isError) {
|
|
1305
|
-
handlePreviewFileEvent(evnt, item)
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
}, fileName),
|
|
1309
|
-
isLoading
|
|
1310
|
-
? h('div', {
|
|
1311
|
-
class: 'vxe-upload--file-item-loading-icon'
|
|
1312
|
-
}, [
|
|
1313
|
-
h('i', {
|
|
1314
|
-
class: getIcon().UPLOAD_LOADING
|
|
1315
|
-
})
|
|
1316
|
-
])
|
|
1317
|
-
: renderEmptyElement($xeUpload),
|
|
1318
|
-
showProgress && isLoading && cacheItem
|
|
1319
|
-
? h('div', {
|
|
1320
|
-
class: 'vxe-upload--file-item-loading-text'
|
|
1321
|
-
}, progressText ? XEUtils.toFormatString(`${XEUtils.isFunction(progressText) ? progressText({}) : progressText}`, { percent: cacheItem.percent }) : getI18n('vxe.upload.uploadProgress', [cacheItem.percent]))
|
|
1322
|
-
: renderEmptyElement($xeUpload),
|
|
1323
|
-
!isLoading && ((isError && showErrorStatus) || (isPending && showSubmitButton && !autoSubmit))
|
|
1324
|
-
? h('div', {
|
|
1325
|
-
class: 'vxe-upload--file-item-rebtn'
|
|
1326
|
-
}, [
|
|
1327
|
-
h(VxeButtonComponent, {
|
|
1328
|
-
icon: isError ? getIcon().UPLOAD_IMAGE_RE_UPLOAD : getIcon().UPLOAD_IMAGE_UPLOAD,
|
|
1329
|
-
mode: 'text',
|
|
1330
|
-
status: 'primary',
|
|
1331
|
-
content: isError ? getI18n('vxe.upload.reUpload') : getI18n('vxe.upload.manualUpload'),
|
|
1332
|
-
onClick () {
|
|
1333
|
-
handleReUpload(item)
|
|
1334
|
-
}
|
|
1335
|
-
})
|
|
1336
|
-
])
|
|
1337
|
-
: renderEmptyElement($xeUpload),
|
|
1338
|
-
h('div', {
|
|
1339
|
-
class: 'vxe-upload--file-item-btn-wrapper'
|
|
1340
|
-
}, [
|
|
1341
|
-
cornerSlot
|
|
1342
|
-
? h('div', {
|
|
1343
|
-
class: 'vxe-upload--file-item-corner'
|
|
1344
|
-
}, getSlotVNs(cornerSlot({ option: item, isMoreView, readonly: formReadonly })))
|
|
1345
|
-
: renderEmptyElement($xeUpload),
|
|
1346
|
-
showDownloadButton && !(isLoading || isPending)
|
|
1347
|
-
? h('div', {
|
|
1348
|
-
class: 'vxe-upload--file-item-download-btn',
|
|
1349
|
-
onClick (evnt: MouseEvent) {
|
|
1350
|
-
downloadFileEvent(evnt, item)
|
|
1351
|
-
}
|
|
1325
|
+
}, optionSlot
|
|
1326
|
+
? getSlotVNs(optionSlot({ option: item, isMoreView, options: fileList }))
|
|
1327
|
+
: [
|
|
1328
|
+
h('div', {
|
|
1329
|
+
class: 'vxe-upload--file-item-icon'
|
|
1352
1330
|
}, [
|
|
1353
1331
|
h('i', {
|
|
1354
|
-
class: getIcon().
|
|
1332
|
+
class: getIcon()[`UPLOAD_FILE_TYPE_${`${item[typeProp]}`.toLocaleUpperCase() as 'DEFAULT'}`] || getIcon().UPLOAD_FILE_TYPE_DEFAULT
|
|
1355
1333
|
})
|
|
1356
|
-
])
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1334
|
+
]),
|
|
1335
|
+
h('div', {
|
|
1336
|
+
class: 'vxe-upload--file-item-name',
|
|
1337
|
+
title: fileName,
|
|
1338
|
+
onClick (evnt) {
|
|
1339
|
+
if (!isLoading && !isError) {
|
|
1340
|
+
handlePreviewFileEvent(evnt, item)
|
|
1341
|
+
}
|
|
1363
1342
|
}
|
|
1364
|
-
},
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1343
|
+
}, nameSlot ? getSlotVNs(nameSlot({ option: item, isMoreView, options: fileList })) : fileName),
|
|
1344
|
+
isLoading
|
|
1345
|
+
? h('div', {
|
|
1346
|
+
class: 'vxe-upload--file-item-loading-icon'
|
|
1347
|
+
}, [
|
|
1348
|
+
h('i', {
|
|
1349
|
+
class: getIcon().UPLOAD_LOADING
|
|
1350
|
+
})
|
|
1351
|
+
])
|
|
1352
|
+
: renderEmptyElement($xeUpload),
|
|
1353
|
+
showProgress && isLoading && cacheItem
|
|
1354
|
+
? h('div', {
|
|
1355
|
+
class: 'vxe-upload--file-item-loading-text'
|
|
1356
|
+
}, progressText ? XEUtils.toFormatString(`${XEUtils.isFunction(progressText) ? progressText({}) : progressText}`, { percent: cacheItem.percent }) : getI18n('vxe.upload.uploadProgress', [cacheItem.percent]))
|
|
1357
|
+
: renderEmptyElement($xeUpload),
|
|
1358
|
+
!isLoading && ((isError && showErrorStatus) || (isPending && showSubmitButton && !autoSubmit))
|
|
1359
|
+
? h('div', {
|
|
1360
|
+
class: 'vxe-upload--file-item-rebtn'
|
|
1361
|
+
}, [
|
|
1362
|
+
h(VxeButtonComponent, {
|
|
1363
|
+
icon: isError ? getIcon().UPLOAD_IMAGE_RE_UPLOAD : getIcon().UPLOAD_IMAGE_UPLOAD,
|
|
1364
|
+
mode: 'text',
|
|
1365
|
+
status: 'primary',
|
|
1366
|
+
content: isError ? getI18n('vxe.upload.reUpload') : getI18n('vxe.upload.manualUpload'),
|
|
1367
|
+
onClick () {
|
|
1368
|
+
handleReUpload(item)
|
|
1369
|
+
}
|
|
1370
|
+
})
|
|
1371
|
+
])
|
|
1372
|
+
: renderEmptyElement($xeUpload),
|
|
1373
|
+
h('div', {
|
|
1374
|
+
class: 'vxe-upload--file-item-btn-wrapper'
|
|
1375
|
+
}, actionSlot
|
|
1376
|
+
? getSlotVNs(actionSlot({ option: item, isMoreView, options: fileList, readonly: formReadonly }))
|
|
1377
|
+
: [
|
|
1378
|
+
cornerSlot
|
|
1379
|
+
? h('div', {
|
|
1380
|
+
class: 'vxe-upload--file-item-action'
|
|
1381
|
+
}, getSlotVNs(cornerSlot({ option: item, isMoreView, options: fileList, readonly: formReadonly })))
|
|
1382
|
+
: renderEmptyElement($xeUpload),
|
|
1383
|
+
showDownloadButton && !(isLoading || isPending)
|
|
1384
|
+
? h('div', {
|
|
1385
|
+
class: 'vxe-upload--file-item-download-btn',
|
|
1386
|
+
onClick (evnt: MouseEvent) {
|
|
1387
|
+
downloadFileEvent(evnt, item)
|
|
1388
|
+
}
|
|
1389
|
+
}, [
|
|
1390
|
+
h('i', {
|
|
1391
|
+
class: getIcon().UPLOAD_FILE_DOWNLOAD
|
|
1392
|
+
})
|
|
1393
|
+
])
|
|
1394
|
+
: renderEmptyElement($xeUpload),
|
|
1395
|
+
showRemoveButton && !formReadonly && !isDisabled && !isLoading
|
|
1396
|
+
? h('div', {
|
|
1397
|
+
class: 'vxe-upload--file-item-remove-btn',
|
|
1398
|
+
onClick (evnt: MouseEvent) {
|
|
1399
|
+
removeFileEvent(evnt, item, index)
|
|
1400
|
+
}
|
|
1401
|
+
}, [
|
|
1402
|
+
h('i', {
|
|
1403
|
+
class: getIcon().UPLOAD_FILE_REMOVE
|
|
1404
|
+
})
|
|
1405
|
+
])
|
|
1406
|
+
: renderEmptyElement($xeUpload)
|
|
1407
|
+
])
|
|
1408
|
+
])
|
|
1372
1409
|
})
|
|
1373
1410
|
}
|
|
1374
1411
|
|
|
1375
1412
|
const renderFileAction = (isMoreView: boolean) => {
|
|
1376
1413
|
const { showUploadButton, buttonText, buttonIcon, showButtonText, showButtonIcon, autoHiddenButton } = props
|
|
1414
|
+
const { fileList } = reactData
|
|
1377
1415
|
const isDisabled = computeIsDisabled.value
|
|
1378
1416
|
const formReadonly = computeFormReadonly.value
|
|
1379
1417
|
const showTipText = computedShowTipText.value
|
|
@@ -1394,7 +1432,7 @@ export default defineVxeComponent({
|
|
|
1394
1432
|
class: 'vxe-upload--file-action-btn',
|
|
1395
1433
|
onClick: clickEvent
|
|
1396
1434
|
}, defaultSlot
|
|
1397
|
-
? getSlotVNs(defaultSlot({ $upload: $xeUpload }))
|
|
1435
|
+
? getSlotVNs(defaultSlot({ isMoreView, options: fileList, $upload: $xeUpload }))
|
|
1398
1436
|
: [
|
|
1399
1437
|
h(VxeButtonComponent, {
|
|
1400
1438
|
class: 'vxe-upload--file-action-button',
|
|
@@ -1406,7 +1444,7 @@ export default defineVxeComponent({
|
|
|
1406
1444
|
showTipText && (defTipText || tipSlot)
|
|
1407
1445
|
? h('div', {
|
|
1408
1446
|
class: 'vxe-upload--file-action-tip'
|
|
1409
|
-
}, tipSlot ? getSlotVNs(tipSlot({ $upload: $xeUpload })) : `${defTipText}`)
|
|
1447
|
+
}, tipSlot ? getSlotVNs(tipSlot({ isMoreView, options: fileList, $upload: $xeUpload })) : `${defTipText}`)
|
|
1410
1448
|
: renderEmptyElement($xeUpload)
|
|
1411
1449
|
])
|
|
1412
1450
|
}
|
|
@@ -1415,9 +1453,9 @@ export default defineVxeComponent({
|
|
|
1415
1453
|
const { showList, moreConfig, dragSort } = props
|
|
1416
1454
|
const { fileList, isDragMove } = reactData
|
|
1417
1455
|
const moreOpts = computeMoreOpts.value
|
|
1418
|
-
|
|
1419
1456
|
const { maxCount, showMoreButton, layout } = moreOpts
|
|
1420
1457
|
const isHorizontal = layout === 'horizontal'
|
|
1458
|
+
const moreBtnSlot = slots.moreButton || slots['more-button']
|
|
1421
1459
|
|
|
1422
1460
|
let currList = fileList
|
|
1423
1461
|
let overMaxNum = 0
|
|
@@ -1458,14 +1496,16 @@ export default defineVxeComponent({
|
|
|
1458
1496
|
showMoreButton && overMaxNum
|
|
1459
1497
|
? h('div', {
|
|
1460
1498
|
class: 'vxe-upload--file-over-more'
|
|
1461
|
-
},
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1499
|
+
}, moreBtnSlot
|
|
1500
|
+
? getSlotVNs(moreBtnSlot({ options: fileList }))
|
|
1501
|
+
: [
|
|
1502
|
+
h(VxeButtonComponent, {
|
|
1503
|
+
mode: 'text',
|
|
1504
|
+
content: getI18n('vxe.upload.moreBtnText', [fileList.length]),
|
|
1505
|
+
status: 'primary',
|
|
1506
|
+
onClick: handleMoreEvent
|
|
1507
|
+
})
|
|
1508
|
+
])
|
|
1469
1509
|
: renderEmptyElement($xeUpload),
|
|
1470
1510
|
showMoreButton && moreConfig && isHorizontal
|
|
1471
1511
|
? renderFileAction(false)
|
|
@@ -1480,11 +1520,13 @@ export default defineVxeComponent({
|
|
|
1480
1520
|
|
|
1481
1521
|
const renderImageItemList = (currList: VxeUploadDefines.FileObjItem[], isMoreView: boolean) => {
|
|
1482
1522
|
const { showRemoveButton, showProgress, progressText, showPreview, showErrorStatus, dragSort, autoSubmit, showSubmitButton } = props
|
|
1483
|
-
const { fileCacheMaps } = reactData
|
|
1523
|
+
const { fileList, fileCacheMaps } = reactData
|
|
1484
1524
|
const isDisabled = computeIsDisabled.value
|
|
1485
1525
|
const formReadonly = computeFormReadonly.value
|
|
1486
1526
|
const imageOpts = computeImageOpts.value
|
|
1487
1527
|
const imgStyle = computeImgStyle.value
|
|
1528
|
+
const optionSlot = slots.option
|
|
1529
|
+
const actionSlot = slots.action
|
|
1488
1530
|
const cornerSlot = slots.corner
|
|
1489
1531
|
|
|
1490
1532
|
const ons: Record<string, any> = {
|
|
@@ -1519,90 +1561,95 @@ export default defineVxeComponent({
|
|
|
1519
1561
|
fileid: fileKey,
|
|
1520
1562
|
draggable: dragSort ? true : null,
|
|
1521
1563
|
...ons
|
|
1522
|
-
},
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
? h('div', {
|
|
1534
|
-
class: 'vxe-upload--image-item-loading'
|
|
1564
|
+
}, optionSlot
|
|
1565
|
+
? getSlotVNs(optionSlot({ option: item, isMoreView, options: fileList }))
|
|
1566
|
+
: [
|
|
1567
|
+
h('div', {
|
|
1568
|
+
class: 'vxe-upload--image-item-box',
|
|
1569
|
+
style: isMoreView ? null : imgStyle,
|
|
1570
|
+
onClick (evnt) {
|
|
1571
|
+
if (!isLoading && !isError) {
|
|
1572
|
+
handlePreviewImageEvent(evnt, item, index)
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1535
1575
|
}, [
|
|
1576
|
+
isLoading && cacheItem
|
|
1577
|
+
? h('div', {
|
|
1578
|
+
class: 'vxe-upload--image-item-loading'
|
|
1579
|
+
}, [
|
|
1580
|
+
h('div', {
|
|
1581
|
+
class: 'vxe-upload--image-item-loading-icon'
|
|
1582
|
+
}, [
|
|
1583
|
+
h('i', {
|
|
1584
|
+
class: getIcon().UPLOAD_LOADING
|
|
1585
|
+
})
|
|
1586
|
+
]),
|
|
1587
|
+
showProgress
|
|
1588
|
+
? h('div', {
|
|
1589
|
+
class: 'vxe-upload--image-item-loading-text'
|
|
1590
|
+
}, progressText ? XEUtils.toFormatString(`${XEUtils.isFunction(progressText) ? progressText({}) : progressText}`, { percent: cacheItem.percent }) : getI18n('vxe.upload.uploadProgress', [cacheItem.percent]))
|
|
1591
|
+
: renderEmptyElement($xeUpload)
|
|
1592
|
+
])
|
|
1593
|
+
: renderEmptyElement($xeUpload),
|
|
1536
1594
|
h('div', {
|
|
1537
|
-
class: 'vxe-upload--image-item-
|
|
1595
|
+
class: 'vxe-upload--image-item-img-wrapper',
|
|
1596
|
+
title: getI18n('vxe.upload.viewItemTitle')
|
|
1538
1597
|
}, [
|
|
1539
|
-
h('
|
|
1540
|
-
class:
|
|
1598
|
+
h('img', {
|
|
1599
|
+
class: 'vxe-upload--image-item-img',
|
|
1600
|
+
src: getThumbnailFileUrl(item)
|
|
1541
1601
|
})
|
|
1542
1602
|
]),
|
|
1543
|
-
|
|
1603
|
+
!isLoading && ((isError && showErrorStatus) || (isPending && showSubmitButton && !autoSubmit))
|
|
1544
1604
|
? h('div', {
|
|
1545
|
-
class: 'vxe-upload--image-item-
|
|
1546
|
-
},
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
class: 'vxe-upload--image-item-rebtn'
|
|
1562
|
-
}, [
|
|
1563
|
-
h(VxeButtonComponent, {
|
|
1564
|
-
icon: isError ? getIcon().UPLOAD_IMAGE_RE_UPLOAD : getIcon().UPLOAD_IMAGE_UPLOAD,
|
|
1565
|
-
mode: 'text',
|
|
1566
|
-
status: 'primary',
|
|
1567
|
-
content: isError ? getI18n('vxe.upload.reUpload') : getI18n('vxe.upload.manualUpload'),
|
|
1568
|
-
onClick () {
|
|
1569
|
-
handleReUpload(item)
|
|
1570
|
-
}
|
|
1571
|
-
})
|
|
1572
|
-
])
|
|
1573
|
-
: renderEmptyElement($xeUpload),
|
|
1574
|
-
h('div', {
|
|
1575
|
-
class: 'vxe-upload--image-item-btn-wrapper',
|
|
1576
|
-
onClick (evnt) {
|
|
1577
|
-
evnt.stopPropagation()
|
|
1578
|
-
}
|
|
1579
|
-
}, [
|
|
1580
|
-
cornerSlot
|
|
1581
|
-
? h('div', {
|
|
1582
|
-
class: 'vxe-upload--file-item-corner'
|
|
1583
|
-
}, getSlotVNs(cornerSlot({ option: item, isMoreView, readonly: formReadonly })))
|
|
1584
|
-
: renderEmptyElement($xeUpload),
|
|
1585
|
-
showRemoveButton && !formReadonly && !isDisabled && !isLoading
|
|
1586
|
-
? h('div', {
|
|
1587
|
-
class: 'vxe-upload--image-item-remove-btn',
|
|
1588
|
-
onClick (evnt: MouseEvent) {
|
|
1605
|
+
class: 'vxe-upload--image-item-rebtn'
|
|
1606
|
+
}, [
|
|
1607
|
+
h(VxeButtonComponent, {
|
|
1608
|
+
icon: isError ? getIcon().UPLOAD_IMAGE_RE_UPLOAD : getIcon().UPLOAD_IMAGE_UPLOAD,
|
|
1609
|
+
mode: 'text',
|
|
1610
|
+
status: 'primary',
|
|
1611
|
+
content: isError ? getI18n('vxe.upload.reUpload') : getI18n('vxe.upload.manualUpload'),
|
|
1612
|
+
onClick () {
|
|
1613
|
+
handleReUpload(item)
|
|
1614
|
+
}
|
|
1615
|
+
})
|
|
1616
|
+
])
|
|
1617
|
+
: renderEmptyElement($xeUpload),
|
|
1618
|
+
h('div', {
|
|
1619
|
+
class: 'vxe-upload--image-item-btn-wrapper',
|
|
1620
|
+
onClick (evnt) {
|
|
1589
1621
|
evnt.stopPropagation()
|
|
1590
|
-
removeFileEvent(evnt, item, index)
|
|
1591
1622
|
}
|
|
1592
|
-
},
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1623
|
+
}, actionSlot
|
|
1624
|
+
? getSlotVNs(actionSlot({ option: item, isMoreView, options: fileList, readonly: formReadonly }))
|
|
1625
|
+
: [
|
|
1626
|
+
cornerSlot
|
|
1627
|
+
? h('div', {
|
|
1628
|
+
class: 'vxe-upload--file-item-action'
|
|
1629
|
+
}, getSlotVNs(cornerSlot({ option: item, isMoreView, options: fileList, readonly: formReadonly })))
|
|
1630
|
+
: renderEmptyElement($xeUpload),
|
|
1631
|
+
showRemoveButton && !formReadonly && !isDisabled && !isLoading
|
|
1632
|
+
? h('div', {
|
|
1633
|
+
class: 'vxe-upload--image-item-remove-btn',
|
|
1634
|
+
onClick (evnt: MouseEvent) {
|
|
1635
|
+
evnt.stopPropagation()
|
|
1636
|
+
removeFileEvent(evnt, item, index)
|
|
1637
|
+
}
|
|
1638
|
+
}, [
|
|
1639
|
+
h('i', {
|
|
1640
|
+
class: getIcon().UPLOAD_IMAGE_REMOVE
|
|
1641
|
+
})
|
|
1642
|
+
])
|
|
1643
|
+
: renderEmptyElement($xeUpload)
|
|
1644
|
+
])
|
|
1645
|
+
])
|
|
1598
1646
|
])
|
|
1599
|
-
])
|
|
1600
|
-
])
|
|
1601
1647
|
})
|
|
1602
1648
|
}
|
|
1603
1649
|
|
|
1604
1650
|
const renderImageAction = (isMoreView: boolean) => {
|
|
1605
1651
|
const { showUploadButton, buttonText, buttonIcon, showButtonText, showButtonIcon, autoHiddenButton } = props
|
|
1652
|
+
const { fileList } = reactData
|
|
1606
1653
|
const formReadonly = computeFormReadonly.value
|
|
1607
1654
|
const showTipText = computedShowTipText.value
|
|
1608
1655
|
const defTipText = computedDefTipText.value
|
|
@@ -1622,7 +1669,7 @@ export default defineVxeComponent({
|
|
|
1622
1669
|
class: 'vxe-upload--image-action-btn',
|
|
1623
1670
|
onClick: clickEvent
|
|
1624
1671
|
}, defaultSlot
|
|
1625
|
-
? defaultSlot({ $upload: $xeUpload })
|
|
1672
|
+
? defaultSlot({ isMoreView, options: fileList, $upload: $xeUpload })
|
|
1626
1673
|
: [
|
|
1627
1674
|
h('div', {
|
|
1628
1675
|
class: 'vxe-upload--image-action-box',
|
|
@@ -1645,7 +1692,7 @@ export default defineVxeComponent({
|
|
|
1645
1692
|
showTipText && (defTipText || tipSlot)
|
|
1646
1693
|
? h('div', {
|
|
1647
1694
|
class: 'vxe-upload--image-action-hint'
|
|
1648
|
-
}, tipSlot ? getSlotVNs(tipSlot({ $upload: $xeUpload })) : `${defTipText}`)
|
|
1695
|
+
}, tipSlot ? getSlotVNs(tipSlot({ isMoreView, options: fileList, $upload: $xeUpload })) : `${defTipText}`)
|
|
1649
1696
|
: renderEmptyElement($xeUpload)
|
|
1650
1697
|
])
|
|
1651
1698
|
])
|
|
@@ -1656,6 +1703,7 @@ export default defineVxeComponent({
|
|
|
1656
1703
|
const { showList, dragSort } = props
|
|
1657
1704
|
const { fileList, isDragMove } = reactData
|
|
1658
1705
|
const moreOpts = computeMoreOpts.value
|
|
1706
|
+
const moreBtnSlot = slots.moreButton || slots['more-button']
|
|
1659
1707
|
|
|
1660
1708
|
const { maxCount, showMoreButton } = moreOpts
|
|
1661
1709
|
let currList = fileList
|
|
@@ -1681,14 +1729,16 @@ export default defineVxeComponent({
|
|
|
1681
1729
|
? h('div', {
|
|
1682
1730
|
key: 'om',
|
|
1683
1731
|
class: 'vxe-upload--image-over-more'
|
|
1684
|
-
},
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1732
|
+
}, moreBtnSlot
|
|
1733
|
+
? getSlotVNs(moreBtnSlot({ options: fileList }))
|
|
1734
|
+
: [
|
|
1735
|
+
h(VxeButtonComponent, {
|
|
1736
|
+
mode: 'text',
|
|
1737
|
+
content: getI18n('vxe.upload.moreBtnText', [fileList.length]),
|
|
1738
|
+
status: 'primary',
|
|
1739
|
+
onClick: handleMoreEvent
|
|
1740
|
+
})
|
|
1741
|
+
])
|
|
1692
1742
|
: renderEmptyElement($xeUpload),
|
|
1693
1743
|
renderImageAction(false)
|
|
1694
1744
|
])
|
|
@@ -1699,14 +1749,16 @@ export default defineVxeComponent({
|
|
|
1699
1749
|
showMoreButton && overMaxNum
|
|
1700
1750
|
? h('div', {
|
|
1701
1751
|
class: 'vxe-upload--image-over-more'
|
|
1702
|
-
},
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1752
|
+
}, moreBtnSlot
|
|
1753
|
+
? getSlotVNs(moreBtnSlot({ options: fileList }))
|
|
1754
|
+
: [
|
|
1755
|
+
h(VxeButtonComponent, {
|
|
1756
|
+
mode: 'text',
|
|
1757
|
+
content: getI18n('vxe.upload.moreBtnText', [fileList.length]),
|
|
1758
|
+
status: 'primary',
|
|
1759
|
+
onClick: handleMoreEvent
|
|
1760
|
+
})
|
|
1761
|
+
])
|
|
1710
1762
|
: renderEmptyElement($xeUpload),
|
|
1711
1763
|
renderImageAction(false)
|
|
1712
1764
|
]))
|