vxe-pc-ui 4.10.22 → 4.10.24
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/date-panel/src/date-panel.js +1 -1
- package/es/date-range-picker/src/date-range-picker.js +6 -0
- 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 +250 -203
- package/lib/date-panel/src/date-panel.js +1 -1
- package/lib/date-panel/src/date-panel.min.js +1 -1
- package/lib/date-range-picker/src/date-range-picker.js +6 -0
- package/lib/date-range-picker/src/date-range-picker.min.js +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +99 -13
- 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 +90 -10
- package/lib/upload/src/upload.min.js +1 -1
- package/package.json +1 -1
- package/packages/date-panel/src/date-panel.ts +1 -1
- package/packages/date-range-picker/src/date-range-picker.ts +6 -0
- package/packages/upload/src/upload.ts +265 -219
- package/types/components/upload.d.ts +54 -4
- /package/es/icon/{iconfont.1762936771626.ttf → iconfont.1763014441538.ttf} +0 -0
- /package/es/icon/{iconfont.1762936771626.woff → iconfont.1763014441538.woff} +0 -0
- /package/es/icon/{iconfont.1762936771626.woff2 → iconfont.1763014441538.woff2} +0 -0
- /package/es/{iconfont.1762936771626.ttf → iconfont.1763014441538.ttf} +0 -0
- /package/es/{iconfont.1762936771626.woff → iconfont.1763014441538.woff} +0 -0
- /package/es/{iconfont.1762936771626.woff2 → iconfont.1763014441538.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1762936771626.ttf → iconfont.1763014441538.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1762936771626.woff → iconfont.1763014441538.woff} +0 -0
- /package/lib/icon/style/{iconfont.1762936771626.woff2 → iconfont.1763014441538.woff2} +0 -0
- /package/lib/{iconfont.1762936771626.ttf → iconfont.1763014441538.ttf} +0 -0
- /package/lib/{iconfont.1762936771626.woff → iconfont.1763014441538.woff} +0 -0
- /package/lib/{iconfont.1762936771626.woff2 → iconfont.1763014441538.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,14 @@ 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
|
|
1260
1291
|
const cornerSlot = slots.corner
|
|
1292
|
+
const nameSlot = slots.name
|
|
1261
1293
|
|
|
1262
1294
|
const ons: Record<string, any> = {}
|
|
1263
1295
|
if (dragSort && currList.length > 1) {
|
|
@@ -1289,91 +1321,94 @@ export default defineVxeComponent({
|
|
|
1289
1321
|
fileid: fileKey,
|
|
1290
1322
|
draggable: dragSort ? true : null,
|
|
1291
1323
|
...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
|
-
}
|
|
1324
|
+
}, optionSlot
|
|
1325
|
+
? getSlotVNs(optionSlot({ option: item, isMoreView, options: fileList }))
|
|
1326
|
+
: [
|
|
1327
|
+
h('div', {
|
|
1328
|
+
class: 'vxe-upload--file-item-icon'
|
|
1352
1329
|
}, [
|
|
1353
1330
|
h('i', {
|
|
1354
|
-
class: getIcon().
|
|
1331
|
+
class: getIcon()[`UPLOAD_FILE_TYPE_${`${item[typeProp]}`.toLocaleUpperCase() as 'DEFAULT'}`] || getIcon().UPLOAD_FILE_TYPE_DEFAULT
|
|
1355
1332
|
})
|
|
1356
|
-
])
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1333
|
+
]),
|
|
1334
|
+
h('div', {
|
|
1335
|
+
class: 'vxe-upload--file-item-name',
|
|
1336
|
+
title: fileName,
|
|
1337
|
+
onClick (evnt) {
|
|
1338
|
+
if (!isLoading && !isError) {
|
|
1339
|
+
handlePreviewFileEvent(evnt, item)
|
|
1340
|
+
}
|
|
1363
1341
|
}
|
|
1342
|
+
}, nameSlot ? getSlotVNs(nameSlot({ option: item, isMoreView, options: fileList })) : fileName),
|
|
1343
|
+
isLoading
|
|
1344
|
+
? h('div', {
|
|
1345
|
+
class: 'vxe-upload--file-item-loading-icon'
|
|
1346
|
+
}, [
|
|
1347
|
+
h('i', {
|
|
1348
|
+
class: getIcon().UPLOAD_LOADING
|
|
1349
|
+
})
|
|
1350
|
+
])
|
|
1351
|
+
: renderEmptyElement($xeUpload),
|
|
1352
|
+
showProgress && isLoading && cacheItem
|
|
1353
|
+
? h('div', {
|
|
1354
|
+
class: 'vxe-upload--file-item-loading-text'
|
|
1355
|
+
}, progressText ? XEUtils.toFormatString(`${XEUtils.isFunction(progressText) ? progressText({}) : progressText}`, { percent: cacheItem.percent }) : getI18n('vxe.upload.uploadProgress', [cacheItem.percent]))
|
|
1356
|
+
: renderEmptyElement($xeUpload),
|
|
1357
|
+
!isLoading && ((isError && showErrorStatus) || (isPending && showSubmitButton && !autoSubmit))
|
|
1358
|
+
? h('div', {
|
|
1359
|
+
class: 'vxe-upload--file-item-rebtn'
|
|
1360
|
+
}, [
|
|
1361
|
+
h(VxeButtonComponent, {
|
|
1362
|
+
icon: isError ? getIcon().UPLOAD_IMAGE_RE_UPLOAD : getIcon().UPLOAD_IMAGE_UPLOAD,
|
|
1363
|
+
mode: 'text',
|
|
1364
|
+
status: 'primary',
|
|
1365
|
+
content: isError ? getI18n('vxe.upload.reUpload') : getI18n('vxe.upload.manualUpload'),
|
|
1366
|
+
onClick () {
|
|
1367
|
+
handleReUpload(item)
|
|
1368
|
+
}
|
|
1369
|
+
})
|
|
1370
|
+
])
|
|
1371
|
+
: renderEmptyElement($xeUpload),
|
|
1372
|
+
h('div', {
|
|
1373
|
+
class: 'vxe-upload--file-item-btn-wrapper'
|
|
1364
1374
|
}, [
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1375
|
+
cornerSlot
|
|
1376
|
+
? h('div', {
|
|
1377
|
+
class: 'vxe-upload--file-item-corner'
|
|
1378
|
+
}, getSlotVNs(cornerSlot({ option: item, isMoreView, options: fileList, readonly: formReadonly })))
|
|
1379
|
+
: renderEmptyElement($xeUpload),
|
|
1380
|
+
showDownloadButton && !(isLoading || isPending)
|
|
1381
|
+
? h('div', {
|
|
1382
|
+
class: 'vxe-upload--file-item-download-btn',
|
|
1383
|
+
onClick (evnt: MouseEvent) {
|
|
1384
|
+
downloadFileEvent(evnt, item)
|
|
1385
|
+
}
|
|
1386
|
+
}, [
|
|
1387
|
+
h('i', {
|
|
1388
|
+
class: getIcon().UPLOAD_FILE_DOWNLOAD
|
|
1389
|
+
})
|
|
1390
|
+
])
|
|
1391
|
+
: renderEmptyElement($xeUpload),
|
|
1392
|
+
showRemoveButton && !formReadonly && !isDisabled && !isLoading
|
|
1393
|
+
? h('div', {
|
|
1394
|
+
class: 'vxe-upload--file-item-remove-btn',
|
|
1395
|
+
onClick (evnt: MouseEvent) {
|
|
1396
|
+
removeFileEvent(evnt, item, index)
|
|
1397
|
+
}
|
|
1398
|
+
}, [
|
|
1399
|
+
h('i', {
|
|
1400
|
+
class: getIcon().UPLOAD_FILE_REMOVE
|
|
1401
|
+
})
|
|
1402
|
+
])
|
|
1403
|
+
: renderEmptyElement($xeUpload)
|
|
1368
1404
|
])
|
|
1369
|
-
|
|
1370
|
-
])
|
|
1371
|
-
])
|
|
1405
|
+
])
|
|
1372
1406
|
})
|
|
1373
1407
|
}
|
|
1374
1408
|
|
|
1375
1409
|
const renderFileAction = (isMoreView: boolean) => {
|
|
1376
1410
|
const { showUploadButton, buttonText, buttonIcon, showButtonText, showButtonIcon, autoHiddenButton } = props
|
|
1411
|
+
const { fileList } = reactData
|
|
1377
1412
|
const isDisabled = computeIsDisabled.value
|
|
1378
1413
|
const formReadonly = computeFormReadonly.value
|
|
1379
1414
|
const showTipText = computedShowTipText.value
|
|
@@ -1394,7 +1429,7 @@ export default defineVxeComponent({
|
|
|
1394
1429
|
class: 'vxe-upload--file-action-btn',
|
|
1395
1430
|
onClick: clickEvent
|
|
1396
1431
|
}, defaultSlot
|
|
1397
|
-
? getSlotVNs(defaultSlot({ $upload: $xeUpload }))
|
|
1432
|
+
? getSlotVNs(defaultSlot({ isMoreView, options: fileList, $upload: $xeUpload }))
|
|
1398
1433
|
: [
|
|
1399
1434
|
h(VxeButtonComponent, {
|
|
1400
1435
|
class: 'vxe-upload--file-action-button',
|
|
@@ -1406,7 +1441,7 @@ export default defineVxeComponent({
|
|
|
1406
1441
|
showTipText && (defTipText || tipSlot)
|
|
1407
1442
|
? h('div', {
|
|
1408
1443
|
class: 'vxe-upload--file-action-tip'
|
|
1409
|
-
}, tipSlot ? getSlotVNs(tipSlot({ $upload: $xeUpload })) : `${defTipText}`)
|
|
1444
|
+
}, tipSlot ? getSlotVNs(tipSlot({ isMoreView, options: fileList, $upload: $xeUpload })) : `${defTipText}`)
|
|
1410
1445
|
: renderEmptyElement($xeUpload)
|
|
1411
1446
|
])
|
|
1412
1447
|
}
|
|
@@ -1415,9 +1450,9 @@ export default defineVxeComponent({
|
|
|
1415
1450
|
const { showList, moreConfig, dragSort } = props
|
|
1416
1451
|
const { fileList, isDragMove } = reactData
|
|
1417
1452
|
const moreOpts = computeMoreOpts.value
|
|
1418
|
-
|
|
1419
1453
|
const { maxCount, showMoreButton, layout } = moreOpts
|
|
1420
1454
|
const isHorizontal = layout === 'horizontal'
|
|
1455
|
+
const moreBtnSlot = slots.moreButton || slots['more-button']
|
|
1421
1456
|
|
|
1422
1457
|
let currList = fileList
|
|
1423
1458
|
let overMaxNum = 0
|
|
@@ -1458,14 +1493,16 @@ export default defineVxeComponent({
|
|
|
1458
1493
|
showMoreButton && overMaxNum
|
|
1459
1494
|
? h('div', {
|
|
1460
1495
|
class: 'vxe-upload--file-over-more'
|
|
1461
|
-
},
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1496
|
+
}, moreBtnSlot
|
|
1497
|
+
? getSlotVNs(moreBtnSlot({ options: fileList }))
|
|
1498
|
+
: [
|
|
1499
|
+
h(VxeButtonComponent, {
|
|
1500
|
+
mode: 'text',
|
|
1501
|
+
content: getI18n('vxe.upload.moreBtnText', [fileList.length]),
|
|
1502
|
+
status: 'primary',
|
|
1503
|
+
onClick: handleMoreEvent
|
|
1504
|
+
})
|
|
1505
|
+
])
|
|
1469
1506
|
: renderEmptyElement($xeUpload),
|
|
1470
1507
|
showMoreButton && moreConfig && isHorizontal
|
|
1471
1508
|
? renderFileAction(false)
|
|
@@ -1480,11 +1517,12 @@ export default defineVxeComponent({
|
|
|
1480
1517
|
|
|
1481
1518
|
const renderImageItemList = (currList: VxeUploadDefines.FileObjItem[], isMoreView: boolean) => {
|
|
1482
1519
|
const { showRemoveButton, showProgress, progressText, showPreview, showErrorStatus, dragSort, autoSubmit, showSubmitButton } = props
|
|
1483
|
-
const { fileCacheMaps } = reactData
|
|
1520
|
+
const { fileList, fileCacheMaps } = reactData
|
|
1484
1521
|
const isDisabled = computeIsDisabled.value
|
|
1485
1522
|
const formReadonly = computeFormReadonly.value
|
|
1486
1523
|
const imageOpts = computeImageOpts.value
|
|
1487
1524
|
const imgStyle = computeImgStyle.value
|
|
1525
|
+
const optionSlot = slots.option
|
|
1488
1526
|
const cornerSlot = slots.corner
|
|
1489
1527
|
|
|
1490
1528
|
const ons: Record<string, any> = {
|
|
@@ -1519,90 +1557,93 @@ export default defineVxeComponent({
|
|
|
1519
1557
|
fileid: fileKey,
|
|
1520
1558
|
draggable: dragSort ? true : null,
|
|
1521
1559
|
...ons
|
|
1522
|
-
},
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
? h('div', {
|
|
1534
|
-
class: 'vxe-upload--image-item-loading'
|
|
1560
|
+
}, optionSlot
|
|
1561
|
+
? getSlotVNs(optionSlot({ option: item, isMoreView, options: fileList }))
|
|
1562
|
+
: [
|
|
1563
|
+
h('div', {
|
|
1564
|
+
class: 'vxe-upload--image-item-box',
|
|
1565
|
+
style: isMoreView ? null : imgStyle,
|
|
1566
|
+
onClick (evnt) {
|
|
1567
|
+
if (!isLoading && !isError) {
|
|
1568
|
+
handlePreviewImageEvent(evnt, item, index)
|
|
1569
|
+
}
|
|
1570
|
+
}
|
|
1535
1571
|
}, [
|
|
1572
|
+
isLoading && cacheItem
|
|
1573
|
+
? h('div', {
|
|
1574
|
+
class: 'vxe-upload--image-item-loading'
|
|
1575
|
+
}, [
|
|
1576
|
+
h('div', {
|
|
1577
|
+
class: 'vxe-upload--image-item-loading-icon'
|
|
1578
|
+
}, [
|
|
1579
|
+
h('i', {
|
|
1580
|
+
class: getIcon().UPLOAD_LOADING
|
|
1581
|
+
})
|
|
1582
|
+
]),
|
|
1583
|
+
showProgress
|
|
1584
|
+
? h('div', {
|
|
1585
|
+
class: 'vxe-upload--image-item-loading-text'
|
|
1586
|
+
}, progressText ? XEUtils.toFormatString(`${XEUtils.isFunction(progressText) ? progressText({}) : progressText}`, { percent: cacheItem.percent }) : getI18n('vxe.upload.uploadProgress', [cacheItem.percent]))
|
|
1587
|
+
: renderEmptyElement($xeUpload)
|
|
1588
|
+
])
|
|
1589
|
+
: renderEmptyElement($xeUpload),
|
|
1536
1590
|
h('div', {
|
|
1537
|
-
class: 'vxe-upload--image-item-
|
|
1591
|
+
class: 'vxe-upload--image-item-img-wrapper',
|
|
1592
|
+
title: getI18n('vxe.upload.viewItemTitle')
|
|
1538
1593
|
}, [
|
|
1539
|
-
h('
|
|
1540
|
-
class:
|
|
1594
|
+
h('img', {
|
|
1595
|
+
class: 'vxe-upload--image-item-img',
|
|
1596
|
+
src: getThumbnailFileUrl(item)
|
|
1541
1597
|
})
|
|
1542
1598
|
]),
|
|
1543
|
-
|
|
1599
|
+
!isLoading && ((isError && showErrorStatus) || (isPending && showSubmitButton && !autoSubmit))
|
|
1544
1600
|
? 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) {
|
|
1601
|
+
class: 'vxe-upload--image-item-rebtn'
|
|
1602
|
+
}, [
|
|
1603
|
+
h(VxeButtonComponent, {
|
|
1604
|
+
icon: isError ? getIcon().UPLOAD_IMAGE_RE_UPLOAD : getIcon().UPLOAD_IMAGE_UPLOAD,
|
|
1605
|
+
mode: 'text',
|
|
1606
|
+
status: 'primary',
|
|
1607
|
+
content: isError ? getI18n('vxe.upload.reUpload') : getI18n('vxe.upload.manualUpload'),
|
|
1608
|
+
onClick () {
|
|
1609
|
+
handleReUpload(item)
|
|
1610
|
+
}
|
|
1611
|
+
})
|
|
1612
|
+
])
|
|
1613
|
+
: renderEmptyElement($xeUpload),
|
|
1614
|
+
h('div', {
|
|
1615
|
+
class: 'vxe-upload--image-item-btn-wrapper',
|
|
1616
|
+
onClick (evnt) {
|
|
1589
1617
|
evnt.stopPropagation()
|
|
1590
|
-
removeFileEvent(evnt, item, index)
|
|
1591
1618
|
}
|
|
1592
1619
|
}, [
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1620
|
+
cornerSlot
|
|
1621
|
+
? h('div', {
|
|
1622
|
+
class: 'vxe-upload--file-item-corner'
|
|
1623
|
+
}, getSlotVNs(cornerSlot({ option: item, isMoreView, options: fileList, readonly: formReadonly })))
|
|
1624
|
+
: renderEmptyElement($xeUpload),
|
|
1625
|
+
showRemoveButton && !formReadonly && !isDisabled && !isLoading
|
|
1626
|
+
? h('div', {
|
|
1627
|
+
class: 'vxe-upload--image-item-remove-btn',
|
|
1628
|
+
onClick (evnt: MouseEvent) {
|
|
1629
|
+
evnt.stopPropagation()
|
|
1630
|
+
removeFileEvent(evnt, item, index)
|
|
1631
|
+
}
|
|
1632
|
+
}, [
|
|
1633
|
+
h('i', {
|
|
1634
|
+
class: getIcon().UPLOAD_IMAGE_REMOVE
|
|
1635
|
+
})
|
|
1636
|
+
])
|
|
1637
|
+
: renderEmptyElement($xeUpload)
|
|
1596
1638
|
])
|
|
1597
|
-
|
|
1639
|
+
])
|
|
1598
1640
|
])
|
|
1599
|
-
])
|
|
1600
|
-
])
|
|
1601
1641
|
})
|
|
1602
1642
|
}
|
|
1603
1643
|
|
|
1604
1644
|
const renderImageAction = (isMoreView: boolean) => {
|
|
1605
1645
|
const { showUploadButton, buttonText, buttonIcon, showButtonText, showButtonIcon, autoHiddenButton } = props
|
|
1646
|
+
const { fileList } = reactData
|
|
1606
1647
|
const formReadonly = computeFormReadonly.value
|
|
1607
1648
|
const showTipText = computedShowTipText.value
|
|
1608
1649
|
const defTipText = computedDefTipText.value
|
|
@@ -1622,7 +1663,7 @@ export default defineVxeComponent({
|
|
|
1622
1663
|
class: 'vxe-upload--image-action-btn',
|
|
1623
1664
|
onClick: clickEvent
|
|
1624
1665
|
}, defaultSlot
|
|
1625
|
-
? defaultSlot({ $upload: $xeUpload })
|
|
1666
|
+
? defaultSlot({ isMoreView, options: fileList, $upload: $xeUpload })
|
|
1626
1667
|
: [
|
|
1627
1668
|
h('div', {
|
|
1628
1669
|
class: 'vxe-upload--image-action-box',
|
|
@@ -1645,7 +1686,7 @@ export default defineVxeComponent({
|
|
|
1645
1686
|
showTipText && (defTipText || tipSlot)
|
|
1646
1687
|
? h('div', {
|
|
1647
1688
|
class: 'vxe-upload--image-action-hint'
|
|
1648
|
-
}, tipSlot ? getSlotVNs(tipSlot({ $upload: $xeUpload })) : `${defTipText}`)
|
|
1689
|
+
}, tipSlot ? getSlotVNs(tipSlot({ isMoreView, options: fileList, $upload: $xeUpload })) : `${defTipText}`)
|
|
1649
1690
|
: renderEmptyElement($xeUpload)
|
|
1650
1691
|
])
|
|
1651
1692
|
])
|
|
@@ -1656,6 +1697,7 @@ export default defineVxeComponent({
|
|
|
1656
1697
|
const { showList, dragSort } = props
|
|
1657
1698
|
const { fileList, isDragMove } = reactData
|
|
1658
1699
|
const moreOpts = computeMoreOpts.value
|
|
1700
|
+
const moreBtnSlot = slots.moreButton || slots['more-button']
|
|
1659
1701
|
|
|
1660
1702
|
const { maxCount, showMoreButton } = moreOpts
|
|
1661
1703
|
let currList = fileList
|
|
@@ -1681,14 +1723,16 @@ export default defineVxeComponent({
|
|
|
1681
1723
|
? h('div', {
|
|
1682
1724
|
key: 'om',
|
|
1683
1725
|
class: 'vxe-upload--image-over-more'
|
|
1684
|
-
},
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1726
|
+
}, moreBtnSlot
|
|
1727
|
+
? getSlotVNs(moreBtnSlot({ options: fileList }))
|
|
1728
|
+
: [
|
|
1729
|
+
h(VxeButtonComponent, {
|
|
1730
|
+
mode: 'text',
|
|
1731
|
+
content: getI18n('vxe.upload.moreBtnText', [fileList.length]),
|
|
1732
|
+
status: 'primary',
|
|
1733
|
+
onClick: handleMoreEvent
|
|
1734
|
+
})
|
|
1735
|
+
])
|
|
1692
1736
|
: renderEmptyElement($xeUpload),
|
|
1693
1737
|
renderImageAction(false)
|
|
1694
1738
|
])
|
|
@@ -1699,14 +1743,16 @@ export default defineVxeComponent({
|
|
|
1699
1743
|
showMoreButton && overMaxNum
|
|
1700
1744
|
? h('div', {
|
|
1701
1745
|
class: 'vxe-upload--image-over-more'
|
|
1702
|
-
},
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1746
|
+
}, moreBtnSlot
|
|
1747
|
+
? getSlotVNs(moreBtnSlot({ options: fileList }))
|
|
1748
|
+
: [
|
|
1749
|
+
h(VxeButtonComponent, {
|
|
1750
|
+
mode: 'text',
|
|
1751
|
+
content: getI18n('vxe.upload.moreBtnText', [fileList.length]),
|
|
1752
|
+
status: 'primary',
|
|
1753
|
+
onClick: handleMoreEvent
|
|
1754
|
+
})
|
|
1755
|
+
])
|
|
1710
1756
|
: renderEmptyElement($xeUpload),
|
|
1711
1757
|
renderImageAction(false)
|
|
1712
1758
|
]))
|