vxe-pc-ui 3.3.35 → 3.3.37

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