vxe-pc-ui 3.3.36 → 3.3.38
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/pulldown/src/pulldown.js +2 -0
- package/es/style.css +1 -1
- package/es/style.min.css +1 -1
- package/es/ui/index.js +1 -1
- package/es/ui/src/dom.js +1 -0
- package/es/ui/src/log.js +1 -1
- package/es/upload/src/upload.js +288 -74
- package/es/upload/style.css +38 -2
- package/es/upload/style.min.css +1 -1
- package/es/vxe-upload/style.css +38 -2
- package/es/vxe-upload/style.min.css +1 -1
- package/helper/vetur/attributes.json +1 -1
- package/helper/vetur/tags.json +1 -1
- package/lib/icon/style/style.css +1 -1
- package/lib/icon/style/style.min.css +1 -1
- package/lib/index.umd.js +270 -52
- package/lib/index.umd.min.js +1 -1
- package/lib/pulldown/src/pulldown.js +6 -0
- package/lib/pulldown/src/pulldown.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/dom.js +2 -0
- package/lib/ui/src/dom.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 +257 -47
- package/lib/upload/src/upload.min.js +1 -1
- package/lib/upload/style/style.css +38 -2
- package/lib/upload/style/style.min.css +1 -1
- package/lib/vxe-upload/style/style.css +38 -2
- package/lib/vxe-upload/style/style.min.css +1 -1
- package/package.json +1 -1
- package/packages/pulldown/src/pulldown.ts +3 -1
- package/packages/ui/src/dom.ts +2 -0
- package/packages/upload/src/upload.ts +306 -75
- package/styles/components/upload.scss +34 -2
- package/types/components/pulldown.d.ts +9 -1
- package/types/components/table.d.ts +4 -0
- package/types/components/upload.d.ts +10 -2
- /package/es/icon/{iconfont.1734331066100.ttf → iconfont.1734402650511.ttf} +0 -0
- /package/es/icon/{iconfont.1734331066100.woff → iconfont.1734402650511.woff} +0 -0
- /package/es/icon/{iconfont.1734331066100.woff2 → iconfont.1734402650511.woff2} +0 -0
- /package/es/{iconfont.1734331066100.ttf → iconfont.1734402650511.ttf} +0 -0
- /package/es/{iconfont.1734331066100.woff → iconfont.1734402650511.woff} +0 -0
- /package/es/{iconfont.1734331066100.woff2 → iconfont.1734402650511.woff2} +0 -0
- /package/lib/icon/style/{iconfont.1734331066100.ttf → iconfont.1734402650511.ttf} +0 -0
- /package/lib/icon/style/{iconfont.1734331066100.woff → iconfont.1734402650511.woff} +0 -0
- /package/lib/icon/style/{iconfont.1734331066100.woff2 → iconfont.1734402650511.woff2} +0 -0
- /package/lib/{iconfont.1734331066100.ttf → iconfont.1734402650511.ttf} +0 -0
- /package/lib/{iconfont.1734331066100.woff → iconfont.1734402650511.woff} +0 -0
- /package/lib/{iconfont.1734331066100.woff2 → iconfont.1734402650511.woff2} +0 -0
package/es/ui/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { VxeUI, setConfig, setIcon } from '@vxe-ui/core';
|
|
|
2
2
|
import { dynamicApp } from '../dynamics';
|
|
3
3
|
import { getFuncText } from './src/utils';
|
|
4
4
|
import { warnLog } from './src/log';
|
|
5
|
-
export const version = "3.3.
|
|
5
|
+
export const version = "3.3.38";
|
|
6
6
|
VxeUI.version = version;
|
|
7
7
|
VxeUI.uiVersion = version;
|
|
8
8
|
VxeUI.tableVersion = '';
|
package/es/ui/src/dom.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import XEUtils from 'xe-utils';
|
|
2
2
|
export const browse = XEUtils.browse();
|
|
3
|
+
export const tpImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=';
|
|
3
4
|
const reClsMap = {};
|
|
4
5
|
function getClsRE(cls) {
|
|
5
6
|
if (!reClsMap[cls]) {
|
package/es/ui/src/log.js
CHANGED
package/es/upload/src/upload.js
CHANGED
|
@@ -2,8 +2,8 @@ import { defineVxeComponent } from '../../ui/src/comp';
|
|
|
2
2
|
import XEUtils from 'xe-utils';
|
|
3
3
|
import { VxeUI, getConfig, getI18n, getIcon, globalMixins, createEvent, globalEvents, renderEmptyElement } from '../../ui';
|
|
4
4
|
import { getSlotVNs } from '../..//ui/src/vn';
|
|
5
|
-
import { errLog } from '../../ui/src/log';
|
|
6
|
-
import { getEventTargetNode, toCssUnit } from '../../ui/src/dom';
|
|
5
|
+
import { errLog, warnLog } from '../../ui/src/log';
|
|
6
|
+
import { tpImg, getEventTargetNode, toCssUnit } from '../../ui/src/dom';
|
|
7
7
|
import { readLocalFile } from './util';
|
|
8
8
|
import VxeButtonComponent from '../../button/src/button';
|
|
9
9
|
function getUniqueKey() {
|
|
@@ -19,6 +19,41 @@ function handleTransferFiles(items) {
|
|
|
19
19
|
});
|
|
20
20
|
return files;
|
|
21
21
|
}
|
|
22
|
+
function showDropTip($xeUpload, evnt, dragEl, dragPos) {
|
|
23
|
+
const { xID } = $xeUpload;
|
|
24
|
+
const reactData = $xeUpload.reactData;
|
|
25
|
+
const { showMorePopup } = reactData;
|
|
26
|
+
const el = $xeUpload.$refs.refElem;
|
|
27
|
+
const popupEl = document.getElementById(`refPopupElem${xID}`);
|
|
28
|
+
const wrapperEl = showMorePopup ? popupEl : el;
|
|
29
|
+
if (!wrapperEl) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
const wrapperRect = wrapperEl.getBoundingClientRect();
|
|
33
|
+
const ddLineEl = $xeUpload.$refs.refDragLineElem;
|
|
34
|
+
const mdLineEl = document.getElementById(`refModalDragLineElem${xID}`);
|
|
35
|
+
const currDLineEl = showMorePopup ? mdLineEl : ddLineEl;
|
|
36
|
+
if (currDLineEl) {
|
|
37
|
+
const dragRect = dragEl.getBoundingClientRect();
|
|
38
|
+
currDLineEl.style.display = 'block';
|
|
39
|
+
currDLineEl.style.top = `${Math.max(1, dragRect.y - wrapperRect.y)}px`;
|
|
40
|
+
currDLineEl.style.left = `${Math.max(1, dragRect.x - wrapperRect.x)}px`;
|
|
41
|
+
currDLineEl.style.height = `${dragRect.height}px`;
|
|
42
|
+
currDLineEl.style.width = `${dragRect.width - 1}px`;
|
|
43
|
+
currDLineEl.setAttribute('drag-pos', dragPos);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function hideDropTip($xeUpload) {
|
|
47
|
+
const { xID } = $xeUpload;
|
|
48
|
+
const ddLineEl = $xeUpload.$refs.refDragLineElem;
|
|
49
|
+
const mdLineEl = document.getElementById(`refModalDragLineElem${xID}`);
|
|
50
|
+
if (ddLineEl) {
|
|
51
|
+
ddLineEl.style.display = '';
|
|
52
|
+
}
|
|
53
|
+
if (mdLineEl) {
|
|
54
|
+
mdLineEl.style.display = '';
|
|
55
|
+
}
|
|
56
|
+
}
|
|
22
57
|
export default defineVxeComponent({
|
|
23
58
|
name: 'VxeUpload',
|
|
24
59
|
model: {
|
|
@@ -67,6 +102,7 @@ export default defineVxeComponent({
|
|
|
67
102
|
type: Array,
|
|
68
103
|
default: () => XEUtils.clone(getConfig().upload.fileTypes, true)
|
|
69
104
|
},
|
|
105
|
+
dragSort: Boolean,
|
|
70
106
|
dragToUpload: {
|
|
71
107
|
type: Boolean,
|
|
72
108
|
default: () => XEUtils.clone(getConfig().upload.dragToUpload, true)
|
|
@@ -178,14 +214,19 @@ export default defineVxeComponent({
|
|
|
178
214
|
data() {
|
|
179
215
|
const xID = XEUtils.uniqueId();
|
|
180
216
|
const reactData = {
|
|
181
|
-
|
|
217
|
+
isDragUploadStatus: false,
|
|
182
218
|
showMorePopup: false,
|
|
183
219
|
isActivated: false,
|
|
184
220
|
fileList: [],
|
|
185
|
-
fileCacheMaps: {}
|
|
221
|
+
fileCacheMaps: {},
|
|
222
|
+
isDragMove: false,
|
|
223
|
+
dragIndex: -1,
|
|
224
|
+
dragTipText: ''
|
|
186
225
|
};
|
|
187
226
|
const internalData = {
|
|
188
|
-
imagePreviewTypes: ['jpg', 'jpeg', 'png', 'gif']
|
|
227
|
+
imagePreviewTypes: ['jpg', 'jpeg', 'png', 'gif'],
|
|
228
|
+
prevDragIndex: -1
|
|
229
|
+
// prevDragPos: ''
|
|
189
230
|
};
|
|
190
231
|
return {
|
|
191
232
|
xID,
|
|
@@ -812,7 +853,7 @@ export default defineVxeComponent({
|
|
|
812
853
|
}
|
|
813
854
|
});
|
|
814
855
|
},
|
|
815
|
-
|
|
856
|
+
handleUploadDragleaveEvent(evnt) {
|
|
816
857
|
const $xeUpload = this;
|
|
817
858
|
const reactData = $xeUpload.reactData;
|
|
818
859
|
const targetElem = evnt.currentTarget;
|
|
@@ -820,11 +861,11 @@ export default defineVxeComponent({
|
|
|
820
861
|
if (targetElem) {
|
|
821
862
|
const { x: targetX, y: targetY, height: targetHeight, width: targetWidth } = targetElem.getBoundingClientRect();
|
|
822
863
|
if (clientX < targetX || clientX > targetX + targetWidth || clientY < targetY || clientY > targetY + targetHeight) {
|
|
823
|
-
reactData.
|
|
864
|
+
reactData.isDragUploadStatus = false;
|
|
824
865
|
}
|
|
825
866
|
}
|
|
826
867
|
},
|
|
827
|
-
|
|
868
|
+
handleUploadDragoverEvent(evnt) {
|
|
828
869
|
const $xeUpload = this;
|
|
829
870
|
const reactData = $xeUpload.reactData;
|
|
830
871
|
const dataTransfer = evnt.dataTransfer;
|
|
@@ -832,7 +873,7 @@ export default defineVxeComponent({
|
|
|
832
873
|
const { items } = dataTransfer;
|
|
833
874
|
if (items && items.length) {
|
|
834
875
|
evnt.preventDefault();
|
|
835
|
-
reactData.
|
|
876
|
+
reactData.isDragUploadStatus = true;
|
|
836
877
|
}
|
|
837
878
|
}
|
|
838
879
|
},
|
|
@@ -866,7 +907,7 @@ export default defineVxeComponent({
|
|
|
866
907
|
}
|
|
867
908
|
$xeUpload.uploadFile(files, evnt);
|
|
868
909
|
},
|
|
869
|
-
|
|
910
|
+
handleUploadDropEvent(evnt) {
|
|
870
911
|
const $xeUpload = this;
|
|
871
912
|
const reactData = $xeUpload.reactData;
|
|
872
913
|
const dataTransfer = evnt.dataTransfer;
|
|
@@ -880,12 +921,13 @@ export default defineVxeComponent({
|
|
|
880
921
|
}
|
|
881
922
|
}
|
|
882
923
|
}
|
|
883
|
-
reactData.
|
|
924
|
+
reactData.isDragUploadStatus = false;
|
|
884
925
|
},
|
|
885
926
|
handleMoreEvent() {
|
|
886
927
|
const $xeUpload = this;
|
|
887
928
|
const props = $xeUpload;
|
|
888
929
|
const reactData = $xeUpload.reactData;
|
|
930
|
+
const { xID } = $xeUpload;
|
|
889
931
|
const formReadonly = $xeUpload.computeFormReadonly;
|
|
890
932
|
const isImage = $xeUpload.computeIsImage;
|
|
891
933
|
if (VxeUI.modal) {
|
|
@@ -899,38 +941,65 @@ export default defineVxeComponent({
|
|
|
899
941
|
maskClosable: true,
|
|
900
942
|
slots: {
|
|
901
943
|
default(params, h) {
|
|
902
|
-
const { showErrorStatus, dragToUpload } = props;
|
|
903
|
-
const {
|
|
904
|
-
const isDisabled = $xeUpload.computeIsDisabled;
|
|
944
|
+
const { showErrorStatus, dragToUpload, dragSort } = props;
|
|
945
|
+
const { isDragMove, isDragUploadStatus, dragIndex } = reactData;
|
|
905
946
|
const { fileList } = reactData;
|
|
947
|
+
const isDisabled = $xeUpload.computeIsDisabled;
|
|
906
948
|
const ons = {};
|
|
907
|
-
if (dragToUpload) {
|
|
908
|
-
ons.dragover = $xeUpload.
|
|
909
|
-
ons.dragleave = $xeUpload.
|
|
910
|
-
ons.drop = $xeUpload.
|
|
949
|
+
if (dragToUpload && dragIndex === -1) {
|
|
950
|
+
ons.dragover = $xeUpload.handleUploadDragoverEvent;
|
|
951
|
+
ons.dragleave = $xeUpload.handleUploadDragleaveEvent;
|
|
952
|
+
ons.drop = $xeUpload.handleUploadDropEvent;
|
|
911
953
|
}
|
|
912
954
|
return h('div', {
|
|
955
|
+
attrs: {
|
|
956
|
+
id: `refPopupElem${xID}`
|
|
957
|
+
},
|
|
913
958
|
class: ['vxe-upload--more-popup', {
|
|
914
959
|
'is--readonly': formReadonly,
|
|
915
960
|
'is--disabled': isDisabled,
|
|
916
961
|
'show--error': showErrorStatus,
|
|
917
|
-
'is--drag':
|
|
962
|
+
'is--drag': isDragUploadStatus
|
|
918
963
|
}],
|
|
919
964
|
on: ons
|
|
920
965
|
}, [
|
|
921
966
|
isImage
|
|
922
|
-
?
|
|
923
|
-
|
|
924
|
-
|
|
967
|
+
? (dragSort
|
|
968
|
+
? h('transition-group', {
|
|
969
|
+
props: {
|
|
970
|
+
name: `vxe-upload--drag-list${isDragMove ? '' : '-disabled'}`,
|
|
971
|
+
tag: 'div'
|
|
972
|
+
},
|
|
973
|
+
class: 'vxe-upload--image-more-list'
|
|
974
|
+
}, $xeUpload.renderImageItemList(h, fileList, true).concat($xeUpload.renderImageAction(h, true)))
|
|
975
|
+
: h('div', {
|
|
976
|
+
class: 'vxe-upload--image-more-list'
|
|
977
|
+
}, $xeUpload.renderImageItemList(h, fileList, true).concat($xeUpload.renderImageAction(h, true))))
|
|
925
978
|
: h('div', {
|
|
926
979
|
class: 'vxe-upload--file-more-list'
|
|
927
980
|
}, [
|
|
928
981
|
$xeUpload.renderFileAction(h, true),
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
982
|
+
(dragSort
|
|
983
|
+
? h('transition-group', {
|
|
984
|
+
props: {
|
|
985
|
+
name: `vxe-upload--drag-list${isDragMove ? '' : '-disabled'}`,
|
|
986
|
+
tag: 'div'
|
|
987
|
+
},
|
|
988
|
+
class: 'vxe-upload--file-list'
|
|
989
|
+
}, $xeUpload.renderFileItemList(h, fileList, true))
|
|
990
|
+
: h('div', {
|
|
991
|
+
class: 'vxe-upload--file-list'
|
|
992
|
+
}, $xeUpload.renderFileItemList(h, fileList, true)))
|
|
932
993
|
]),
|
|
933
|
-
|
|
994
|
+
dragSort
|
|
995
|
+
? h('div', {
|
|
996
|
+
attrs: {
|
|
997
|
+
id: `refModalDragLineElem${xID}`
|
|
998
|
+
},
|
|
999
|
+
class: 'vxe-upload--drag-line'
|
|
1000
|
+
})
|
|
1001
|
+
: renderEmptyElement($xeUpload),
|
|
1002
|
+
isDragUploadStatus
|
|
934
1003
|
? h('div', {
|
|
935
1004
|
class: 'vxe-upload--drag-placeholder'
|
|
936
1005
|
}, getI18n('vxe.upload.dragPlaceholder'))
|
|
@@ -938,15 +1007,95 @@ export default defineVxeComponent({
|
|
|
938
1007
|
]);
|
|
939
1008
|
}
|
|
940
1009
|
},
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
1010
|
+
events: {
|
|
1011
|
+
show() {
|
|
1012
|
+
reactData.showMorePopup = true;
|
|
1013
|
+
},
|
|
1014
|
+
hide() {
|
|
1015
|
+
reactData.showMorePopup = false;
|
|
1016
|
+
}
|
|
946
1017
|
}
|
|
947
1018
|
});
|
|
948
1019
|
}
|
|
949
1020
|
},
|
|
1021
|
+
// 拖拽
|
|
1022
|
+
handleDragSortDragstartEvent(evnt) {
|
|
1023
|
+
const $xeUpload = this;
|
|
1024
|
+
const reactData = $xeUpload.reactData;
|
|
1025
|
+
if (evnt.dataTransfer) {
|
|
1026
|
+
const img = new Image();
|
|
1027
|
+
img.src = tpImg;
|
|
1028
|
+
evnt.dataTransfer.setDragImage(img, 0, 0);
|
|
1029
|
+
}
|
|
1030
|
+
const dragEl = evnt.currentTarget;
|
|
1031
|
+
const parentEl = dragEl.parentElement;
|
|
1032
|
+
const dragIndex = XEUtils.findIndexOf(Array.from(parentEl.children), item => dragEl === item);
|
|
1033
|
+
reactData.isDragMove = true;
|
|
1034
|
+
reactData.dragIndex = dragIndex;
|
|
1035
|
+
setTimeout(() => {
|
|
1036
|
+
reactData.isDragMove = false;
|
|
1037
|
+
}, 500);
|
|
1038
|
+
},
|
|
1039
|
+
handleDragSortDragoverEvent(evnt) {
|
|
1040
|
+
const $xeUpload = this;
|
|
1041
|
+
const reactData = $xeUpload.reactData;
|
|
1042
|
+
const internalData = $xeUpload.internalData;
|
|
1043
|
+
evnt.preventDefault();
|
|
1044
|
+
const { dragIndex } = reactData;
|
|
1045
|
+
if (dragIndex === -1) {
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
const isImage = $xeUpload.computeIsImage;
|
|
1049
|
+
const dragEl = evnt.currentTarget;
|
|
1050
|
+
const parentEl = dragEl.parentElement;
|
|
1051
|
+
const currIndex = XEUtils.findIndexOf(Array.from(parentEl.children), item => dragEl === item);
|
|
1052
|
+
let dragPos = '';
|
|
1053
|
+
if (isImage) {
|
|
1054
|
+
const offsetX = evnt.clientX - dragEl.getBoundingClientRect().x;
|
|
1055
|
+
dragPos = offsetX < dragEl.clientWidth / 2 ? 'left' : 'right';
|
|
1056
|
+
}
|
|
1057
|
+
else {
|
|
1058
|
+
const offsetY = evnt.clientY - dragEl.getBoundingClientRect().y;
|
|
1059
|
+
dragPos = offsetY < dragEl.clientHeight / 2 ? 'top' : 'bottom';
|
|
1060
|
+
}
|
|
1061
|
+
if (dragIndex === currIndex) {
|
|
1062
|
+
showDropTip($xeUpload, evnt, dragEl, dragPos);
|
|
1063
|
+
return;
|
|
1064
|
+
}
|
|
1065
|
+
showDropTip($xeUpload, evnt, dragEl, dragPos);
|
|
1066
|
+
internalData.prevDragIndex = currIndex;
|
|
1067
|
+
internalData.prevDragPos = dragPos;
|
|
1068
|
+
},
|
|
1069
|
+
handleDragSortDragendEvent(evnt) {
|
|
1070
|
+
const $xeUpload = this;
|
|
1071
|
+
const reactData = $xeUpload.reactData;
|
|
1072
|
+
const internalData = $xeUpload.internalData;
|
|
1073
|
+
const { fileList, dragIndex } = reactData;
|
|
1074
|
+
const { prevDragIndex, prevDragPos } = internalData;
|
|
1075
|
+
const oldIndex = dragIndex;
|
|
1076
|
+
const targetIndex = prevDragIndex;
|
|
1077
|
+
const dragOffsetIndex = prevDragPos === 'bottom' || prevDragPos === 'right' ? 1 : 0;
|
|
1078
|
+
const oldItem = fileList[oldIndex];
|
|
1079
|
+
const newItem = fileList[targetIndex];
|
|
1080
|
+
if (oldItem && newItem) {
|
|
1081
|
+
fileList.splice(oldIndex, 1);
|
|
1082
|
+
const ptfIndex = XEUtils.findIndexOf(fileList, item => newItem === item);
|
|
1083
|
+
const nIndex = ptfIndex + dragOffsetIndex;
|
|
1084
|
+
fileList.splice(nIndex, 0, oldItem);
|
|
1085
|
+
$xeUpload.dispatchEvent('sort-dragend', {
|
|
1086
|
+
oldItem: oldItem,
|
|
1087
|
+
newItem: newItem,
|
|
1088
|
+
dragPos: prevDragPos,
|
|
1089
|
+
offsetIndex: dragOffsetIndex,
|
|
1090
|
+
_index: {
|
|
1091
|
+
newIndex: nIndex,
|
|
1092
|
+
oldIndex: oldIndex
|
|
1093
|
+
}
|
|
1094
|
+
}, evnt);
|
|
1095
|
+
}
|
|
1096
|
+
hideDropTip($xeUpload);
|
|
1097
|
+
reactData.dragIndex = -1;
|
|
1098
|
+
},
|
|
950
1099
|
handleGlobalPasteEvent(evnt) {
|
|
951
1100
|
const $xeUpload = this;
|
|
952
1101
|
const props = $xeUpload;
|
|
@@ -990,25 +1139,36 @@ export default defineVxeComponent({
|
|
|
990
1139
|
const props = $xeUpload;
|
|
991
1140
|
const slots = $xeUpload.$scopedSlots;
|
|
992
1141
|
const reactData = $xeUpload.reactData;
|
|
993
|
-
const { showRemoveButton, showDownloadButton, showProgress, progressText, showPreview, showErrorStatus } = props;
|
|
1142
|
+
const { showRemoveButton, showDownloadButton, showProgress, progressText, showPreview, showErrorStatus, dragSort } = props;
|
|
994
1143
|
const { fileCacheMaps } = reactData;
|
|
995
1144
|
const isDisabled = $xeUpload.computeIsDisabled;
|
|
996
1145
|
const formReadonly = $xeUpload.computeFormReadonly;
|
|
997
1146
|
const nameProp = $xeUpload.computeNameProp;
|
|
998
1147
|
const typeProp = $xeUpload.computeTypeProp;
|
|
999
1148
|
const cornerSlot = slots.corner;
|
|
1149
|
+
const ons = {};
|
|
1150
|
+
if (dragSort) {
|
|
1151
|
+
ons.dragstart = $xeUpload.handleDragSortDragstartEvent;
|
|
1152
|
+
ons.dragover = $xeUpload.handleDragSortDragoverEvent;
|
|
1153
|
+
ons.dragend = $xeUpload.handleDragSortDragendEvent;
|
|
1154
|
+
}
|
|
1000
1155
|
return currList.map((item, index) => {
|
|
1001
1156
|
const fileKey = $xeUpload.getFieldKey(item);
|
|
1002
1157
|
const cacheItem = fileCacheMaps[fileKey];
|
|
1003
1158
|
const isLoading = cacheItem && cacheItem.loading;
|
|
1004
1159
|
const isError = cacheItem && cacheItem.status === 'error';
|
|
1005
1160
|
return h('div', {
|
|
1006
|
-
key: index,
|
|
1161
|
+
key: dragSort ? fileKey : index,
|
|
1007
1162
|
class: ['vxe-upload--file-item', {
|
|
1008
1163
|
'is--preview': showPreview,
|
|
1009
1164
|
'is--loading': isLoading,
|
|
1010
1165
|
'is--error': isError
|
|
1011
|
-
}]
|
|
1166
|
+
}],
|
|
1167
|
+
attrs: {
|
|
1168
|
+
fileid: fileKey,
|
|
1169
|
+
draggable: dragSort ? true : null
|
|
1170
|
+
},
|
|
1171
|
+
on: ons
|
|
1012
1172
|
}, [
|
|
1013
1173
|
h('div', {
|
|
1014
1174
|
class: 'vxe-upload--file-item-icon'
|
|
@@ -1147,8 +1307,8 @@ export default defineVxeComponent({
|
|
|
1147
1307
|
const $xeUpload = this;
|
|
1148
1308
|
const props = $xeUpload;
|
|
1149
1309
|
const reactData = $xeUpload.reactData;
|
|
1150
|
-
const { moreConfig } = props;
|
|
1151
|
-
const { fileList } = reactData;
|
|
1310
|
+
const { moreConfig, dragSort } = props;
|
|
1311
|
+
const { fileList, isDragMove } = reactData;
|
|
1152
1312
|
const moreOpts = $xeUpload.computeMoreOpts;
|
|
1153
1313
|
const { maxCount, showMoreButton, layout } = moreOpts;
|
|
1154
1314
|
const isHorizontal = layout === 'horizontal';
|
|
@@ -1172,9 +1332,17 @@ export default defineVxeComponent({
|
|
|
1172
1332
|
}]
|
|
1173
1333
|
}, [
|
|
1174
1334
|
currList.length
|
|
1175
|
-
?
|
|
1176
|
-
|
|
1177
|
-
|
|
1335
|
+
? (dragSort
|
|
1336
|
+
? h('transition-group', {
|
|
1337
|
+
attrs: {
|
|
1338
|
+
name: `vxe-upload--drag-list${isDragMove ? '' : '-disabled'}`,
|
|
1339
|
+
tag: 'div'
|
|
1340
|
+
},
|
|
1341
|
+
class: 'vxe-upload--file-list'
|
|
1342
|
+
}, $xeUpload.renderFileItemList(h, currList, false))
|
|
1343
|
+
: h('div', {
|
|
1344
|
+
class: 'vxe-upload--file-list'
|
|
1345
|
+
}, $xeUpload.renderFileItemList(h, currList, false)))
|
|
1178
1346
|
: renderEmptyElement($xeUpload),
|
|
1179
1347
|
showMoreButton && overMaxNum
|
|
1180
1348
|
? h('div', {
|
|
@@ -1204,26 +1372,37 @@ export default defineVxeComponent({
|
|
|
1204
1372
|
const props = $xeUpload;
|
|
1205
1373
|
const slots = $xeUpload.$scopedSlots;
|
|
1206
1374
|
const reactData = $xeUpload.reactData;
|
|
1207
|
-
const { showRemoveButton, showProgress, progressText, showPreview, showErrorStatus } = props;
|
|
1375
|
+
const { showRemoveButton, showProgress, progressText, showPreview, showErrorStatus, dragSort } = props;
|
|
1208
1376
|
const { fileCacheMaps } = reactData;
|
|
1209
1377
|
const isDisabled = $xeUpload.computeIsDisabled;
|
|
1210
1378
|
const formReadonly = $xeUpload.computeFormReadonly;
|
|
1211
1379
|
const imageOpts = $xeUpload.computeImageOpts;
|
|
1212
1380
|
const imgStyle = $xeUpload.computeImgStyle;
|
|
1213
1381
|
const cornerSlot = slots.corner;
|
|
1382
|
+
const ons = {};
|
|
1383
|
+
if (dragSort) {
|
|
1384
|
+
ons.dragstart = $xeUpload.handleDragSortDragstartEvent;
|
|
1385
|
+
ons.dragover = $xeUpload.handleDragSortDragoverEvent;
|
|
1386
|
+
ons.dragend = $xeUpload.handleDragSortDragendEvent;
|
|
1387
|
+
}
|
|
1214
1388
|
return currList.map((item, index) => {
|
|
1215
1389
|
const fileKey = $xeUpload.getFieldKey(item);
|
|
1216
1390
|
const cacheItem = fileCacheMaps[fileKey];
|
|
1217
1391
|
const isLoading = cacheItem && cacheItem.loading;
|
|
1218
1392
|
const isError = cacheItem && cacheItem.status === 'error';
|
|
1219
1393
|
return h('div', {
|
|
1220
|
-
key: index,
|
|
1394
|
+
key: dragSort ? fileKey : index,
|
|
1221
1395
|
class: ['vxe-upload--image-item', {
|
|
1222
1396
|
'is--preview': showPreview,
|
|
1223
1397
|
'is--circle': imageOpts.circle,
|
|
1224
1398
|
'is--loading': isLoading,
|
|
1225
1399
|
'is--error': isError
|
|
1226
|
-
}]
|
|
1400
|
+
}],
|
|
1401
|
+
attrs: {
|
|
1402
|
+
fileid: fileKey,
|
|
1403
|
+
draggable: dragSort ? true : null
|
|
1404
|
+
},
|
|
1405
|
+
on: ons
|
|
1227
1406
|
}, [
|
|
1228
1407
|
h('div', {
|
|
1229
1408
|
class: 'vxe-upload--image-item-box',
|
|
@@ -1375,8 +1554,10 @@ export default defineVxeComponent({
|
|
|
1375
1554
|
},
|
|
1376
1555
|
renderImageMode(h) {
|
|
1377
1556
|
const $xeUpload = this;
|
|
1557
|
+
const props = $xeUpload;
|
|
1378
1558
|
const reactData = $xeUpload.reactData;
|
|
1379
|
-
const {
|
|
1559
|
+
const { dragSort } = props;
|
|
1560
|
+
const { fileList, isDragMove } = reactData;
|
|
1380
1561
|
const moreOpts = $xeUpload.computeMoreOpts;
|
|
1381
1562
|
const { maxCount, showMoreButton } = moreOpts;
|
|
1382
1563
|
let currList = fileList;
|
|
@@ -1389,44 +1570,71 @@ export default defineVxeComponent({
|
|
|
1389
1570
|
key: 'image',
|
|
1390
1571
|
class: 'vxe-upload--image-wrapper'
|
|
1391
1572
|
}, [
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1573
|
+
dragSort
|
|
1574
|
+
? h('transition-group', {
|
|
1575
|
+
attrs: {
|
|
1576
|
+
name: `vxe-upload--drag-list${isDragMove ? '' : '-disabled'}`,
|
|
1577
|
+
tag: 'div'
|
|
1578
|
+
},
|
|
1579
|
+
class: 'vxe-upload--image-list'
|
|
1580
|
+
}, $xeUpload.renderImageItemList(h, currList, false).concat([
|
|
1581
|
+
showMoreButton && overMaxNum
|
|
1582
|
+
? h('div', {
|
|
1583
|
+
key: 'om',
|
|
1584
|
+
class: 'vxe-upload--image-over-more'
|
|
1585
|
+
}, [
|
|
1586
|
+
h(VxeButtonComponent, {
|
|
1587
|
+
props: {
|
|
1588
|
+
mode: 'text',
|
|
1589
|
+
content: getI18n('vxe.upload.moreBtnText', [fileList.length]),
|
|
1590
|
+
status: 'primary'
|
|
1591
|
+
},
|
|
1592
|
+
on: {
|
|
1593
|
+
click: $xeUpload.handleMoreEvent
|
|
1594
|
+
}
|
|
1595
|
+
})
|
|
1596
|
+
])
|
|
1597
|
+
: renderEmptyElement($xeUpload),
|
|
1598
|
+
$xeUpload.renderImageAction(h, false)
|
|
1599
|
+
]))
|
|
1600
|
+
: h('div', {
|
|
1601
|
+
class: 'vxe-upload--image-list'
|
|
1602
|
+
}, $xeUpload.renderImageItemList(h, currList, false).concat([
|
|
1603
|
+
showMoreButton && overMaxNum
|
|
1604
|
+
? h('div', {
|
|
1605
|
+
class: 'vxe-upload--image-over-more'
|
|
1606
|
+
}, [
|
|
1607
|
+
h(VxeButtonComponent, {
|
|
1608
|
+
props: {
|
|
1609
|
+
mode: 'text',
|
|
1610
|
+
content: getI18n('vxe.upload.moreBtnText', [fileList.length]),
|
|
1611
|
+
status: 'primary'
|
|
1612
|
+
},
|
|
1613
|
+
on: {
|
|
1614
|
+
click: $xeUpload.handleMoreEvent
|
|
1615
|
+
}
|
|
1616
|
+
})
|
|
1617
|
+
])
|
|
1618
|
+
: renderEmptyElement($xeUpload),
|
|
1619
|
+
$xeUpload.renderImageAction(h, false)
|
|
1620
|
+
]))
|
|
1413
1621
|
]);
|
|
1414
1622
|
},
|
|
1415
1623
|
renderVN(h) {
|
|
1416
1624
|
const $xeUpload = this;
|
|
1417
1625
|
const props = $xeUpload;
|
|
1418
1626
|
const reactData = $xeUpload.reactData;
|
|
1419
|
-
const { showErrorStatus, dragToUpload, pasteToUpload } = props;
|
|
1420
|
-
const {
|
|
1627
|
+
const { showErrorStatus, dragToUpload, pasteToUpload, dragSort } = props;
|
|
1628
|
+
const { isDragUploadStatus, showMorePopup, isActivated, dragIndex } = reactData;
|
|
1421
1629
|
const vSize = $xeUpload.computeSize;
|
|
1422
1630
|
const isDisabled = $xeUpload.computeIsDisabled;
|
|
1423
1631
|
const formReadonly = $xeUpload.computeFormReadonly;
|
|
1424
1632
|
const isImage = $xeUpload.computeIsImage;
|
|
1425
1633
|
const ons = {};
|
|
1426
|
-
if (dragToUpload) {
|
|
1427
|
-
ons.dragover = $xeUpload.
|
|
1428
|
-
ons.dragleave = $xeUpload.
|
|
1429
|
-
ons.drop = $xeUpload.
|
|
1634
|
+
if (dragToUpload && dragIndex === -1) {
|
|
1635
|
+
ons.dragover = $xeUpload.handleUploadDragoverEvent;
|
|
1636
|
+
ons.dragleave = $xeUpload.handleUploadDragleaveEvent;
|
|
1637
|
+
ons.drop = $xeUpload.handleUploadDropEvent;
|
|
1430
1638
|
}
|
|
1431
1639
|
return h('div', {
|
|
1432
1640
|
ref: 'refElem',
|
|
@@ -1437,12 +1645,18 @@ export default defineVxeComponent({
|
|
|
1437
1645
|
'is--disabled': isDisabled,
|
|
1438
1646
|
'is--paste': pasteToUpload,
|
|
1439
1647
|
'show--error': showErrorStatus,
|
|
1440
|
-
'is--drag':
|
|
1648
|
+
'is--drag': isDragUploadStatus
|
|
1441
1649
|
}],
|
|
1442
1650
|
on: ons
|
|
1443
1651
|
}, [
|
|
1444
1652
|
isImage ? $xeUpload.renderImageMode(h) : $xeUpload.renderAllMode(h),
|
|
1445
|
-
|
|
1653
|
+
dragSort
|
|
1654
|
+
? h('div', {
|
|
1655
|
+
ref: 'refDragLineElem',
|
|
1656
|
+
class: 'vxe-upload--drag-line'
|
|
1657
|
+
})
|
|
1658
|
+
: renderEmptyElement($xeUpload),
|
|
1659
|
+
isDragUploadStatus && !showMorePopup
|
|
1446
1660
|
? h('div', {
|
|
1447
1661
|
class: 'vxe-upload--drag-placeholder'
|
|
1448
1662
|
}, getI18n('vxe.upload.dragPlaceholder'))
|
|
@@ -1462,7 +1676,7 @@ export default defineVxeComponent({
|
|
|
1462
1676
|
errLog('vxe.error.errConflicts', ['multiple', 'single-mode']);
|
|
1463
1677
|
}
|
|
1464
1678
|
if (props.imageStyle) {
|
|
1465
|
-
|
|
1679
|
+
warnLog('vxe.error.delProp', ['image-style', 'image-config']);
|
|
1466
1680
|
}
|
|
1467
1681
|
}
|
|
1468
1682
|
globalEvents.on($xeUpload, 'paste', $xeUpload.handleGlobalPasteEvent);
|
|
@@ -1472,7 +1686,7 @@ export default defineVxeComponent({
|
|
|
1472
1686
|
beforeDestroy() {
|
|
1473
1687
|
const $xeUpload = this;
|
|
1474
1688
|
const reactData = $xeUpload.reactData;
|
|
1475
|
-
reactData.
|
|
1689
|
+
reactData.isDragUploadStatus = false;
|
|
1476
1690
|
globalEvents.off($xeUpload, 'paste');
|
|
1477
1691
|
globalEvents.off($xeUpload, 'mousedown');
|
|
1478
1692
|
globalEvents.off($xeUpload, 'blur');
|
package/es/upload/style.css
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
@charset "UTF-8";
|
|
1
2
|
.vxe-upload {
|
|
2
3
|
position: relative;
|
|
3
4
|
color: var(--vxe-ui-font-color);
|
|
@@ -72,8 +73,7 @@
|
|
|
72
73
|
flex-direction: row;
|
|
73
74
|
align-items: center;
|
|
74
75
|
line-height: 1.5em;
|
|
75
|
-
|
|
76
|
-
padding: 0.1em var(--vxe-ui-layout-padding-half);
|
|
76
|
+
padding: var(--vxe-ui-layout-padding-half);
|
|
77
77
|
}
|
|
78
78
|
.vxe-upload--file-item:hover {
|
|
79
79
|
background-color: var(--vxe-ui-base-hover-background-color);
|
|
@@ -366,6 +366,42 @@
|
|
|
366
366
|
white-space: nowrap;
|
|
367
367
|
}
|
|
368
368
|
|
|
369
|
+
/*拖拽排序*/
|
|
370
|
+
.vxe-upload--drag-line {
|
|
371
|
+
display: none;
|
|
372
|
+
position: absolute;
|
|
373
|
+
top: 0;
|
|
374
|
+
left: 0;
|
|
375
|
+
z-index: 3;
|
|
376
|
+
pointer-events: none;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.vxe-upload--drag-line {
|
|
380
|
+
width: 1px;
|
|
381
|
+
height: 1px;
|
|
382
|
+
border: 2px solid transparent;
|
|
383
|
+
}
|
|
384
|
+
.vxe-upload--drag-line[drag-pos=top] {
|
|
385
|
+
border-top-color: var(--vxe-ui-font-primary-color);
|
|
386
|
+
}
|
|
387
|
+
.vxe-upload--drag-line[drag-pos=bottom] {
|
|
388
|
+
border-bottom-color: var(--vxe-ui-font-primary-color);
|
|
389
|
+
}
|
|
390
|
+
.vxe-upload--drag-line[drag-pos=left] {
|
|
391
|
+
border-left-color: var(--vxe-ui-font-primary-color);
|
|
392
|
+
}
|
|
393
|
+
.vxe-upload--drag-line[drag-pos=right] {
|
|
394
|
+
border-right-color: var(--vxe-ui-font-primary-color);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.vxe-upload--drag-list-move {
|
|
398
|
+
transition: transform 0.2s;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.vxe-upload--more-popup {
|
|
402
|
+
position: relative;
|
|
403
|
+
}
|
|
404
|
+
|
|
369
405
|
.vxe-upload,
|
|
370
406
|
.vxe-upload--more-popup {
|
|
371
407
|
font-size: var(--vxe-ui-font-size-default);
|