iov-design 2.15.123 → 2.15.124

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/lib/upload.js CHANGED
@@ -227,8 +227,8 @@ module.exports = require("iov-design/lib/utils/file-icon");
227
227
  // ESM COMPAT FLAG
228
228
  __webpack_require__.r(__webpack_exports__);
229
229
 
230
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload-list.vue?vue&type=template&id=4440ee8e
231
- var upload_listvue_type_template_id_4440ee8e_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('transition-group',{class:[
230
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload-list.vue?vue&type=template&id=61654d05
231
+ var upload_listvue_type_template_id_61654d05_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('transition-group',{class:[
232
232
  'el-upload-list',
233
233
  'el-upload-list--' + _vm.listType,
234
234
  { 'is-disabled': _vm.disabled,
@@ -241,11 +241,11 @@ var upload_listvue_type_template_id_4440ee8e_render = function () {var _vm=this;
241
241
  'is-' + file.status,
242
242
  _vm.focusing ? 'focusing' : '',
243
243
  { 'is-dragging': _vm.dragState.isDragging && _vm.dragState.draggingFile && _vm.dragState.draggingFile.uid === file.uid }
244
- ],attrs:{"data-uid":file.uid,"tabindex":"0","draggable":_vm.sortable && _vm.listType === 'picture-card' && file.status === 'success' && !_vm.disabled},on:{"focus":function($event){_vm.focusing = true},"blur":function($event){_vm.focusing = false},"click":function($event){_vm.focusing = false},"dragstart":function($event){_vm.handleDragStart($event, file)},"dragover":function($event){_vm.handleDragOver($event, file)},"dragleave":function($event){_vm.handleDragLeave($event, file)},"drop":function($event){_vm.handleDrop($event, file)},"dragend":function($event){_vm.handleDragEnd($event, file)}}},[_vm._t("default",[_c('div',{staticClass:"el-upload-list__file"},[_c('div',{staticClass:"el-upload-list__item-name",on:{"click":function($event){_vm.onPreview(file)}}},[(['picture'].includes(_vm.listType) || ['picture-card'].includes(_vm.listType) && file.status === 'success')?_c('span',{staticClass:"el-upload-list__item-thumbnail"},[_c('el-image',{attrs:{"src":file[_vm.fileUrlAlias],"preview-src-list":_vm.handlePreview ? [] : [file[_vm.fileUrlAlias]],"fit":"contain"}},[_c('i',{staticClass:"el-image__placeholder",attrs:{"slot":"placeholder"},slot:"placeholder"}),_c('i',{staticClass:"el-image__error",attrs:{"slot":"error"},slot:"error"})])],1):(['text'].includes(_vm.listType))?_c('i',{staticClass:"el-upload-list__icon",style:(_vm.iconStyle(file.name || file[_vm.fileNameAlias]))}):_vm._e(),(['text', 'picture'].includes(_vm.listType))?_c('div',{staticClass:"el-upload-list__name"},[_c('span',{staticClass:"file-name"},[_vm._v(_vm._s(file.name || file[_vm.fileNameAlias]))])]):_vm._e()]),(['text', 'picture'].includes(_vm.listType))?_c('div',{staticClass:"el-upload-list__item-status-label"},[(file.status === 'uploading')?_c('el-progress',{staticClass:"el-upload-progress",attrs:{"percentage":file.percentage,"width":14,"stroke-width":7,"show-text":false,"type":"circle","stroke-linecap":"butt"}}):(file.status === 'success')?_c('i',{staticClass:"el-upload-success iov-icon-success"}):_vm._e()],1):(['picture-card'].includes(_vm.listType) && file.status === 'uploading')?_c('div',{staticClass:"el-upload-list__item-status-label"},[_c('el-progress',{staticClass:"el-upload-progress",attrs:{"percentage":file.percentage,"stroke-width":2,"show-text":false,"type":"line","color":"#3F57FF","define-back-color":"#F2F3F5"}}),_c('span',{staticClass:"el-upload-progress__text"},[_vm._v("上传中")])],1):_vm._e()]),(!_vm.disabled && ['text', 'picture'].includes(_vm.listType))?_c('i',{staticClass:"iov-icon-delete",on:{"click":function($event){$event.stopPropagation();_vm.$emit('remove', file)}}}):_vm._e(),(_vm.listType === 'picture-card' && file.status === 'success' && _vm.actions.length > 0)?_c('span',{staticClass:"el-upload-list__item-actions"},[(_vm.handlePreview && _vm.actions.includes('preview'))?_c('i',{staticClass:"el-upload-list__item-preview iov-icon-eye",on:{"click":function($event){$event.stopPropagation();_vm.onPreview(file)}}}):_vm._e(),(!_vm.disabled && _vm.actions.includes('update'))?_c('i',{staticClass:"el-upload-list__item-update iov-icon-update",on:{"click":function($event){$event.stopPropagation();return _vm.onUpdate($event)}}}):_vm._e(),(!_vm.disabled && _vm.actions.includes('remove'))?_c('i',{staticClass:"el-upload-list__item-delete iov-icon-delete",on:{"click":function($event){$event.stopPropagation();_vm.$emit('remove', file)}}}):_vm._e()]):_vm._e()],{file:file})],2)}),0)}
244
+ ],attrs:{"data-uid":file.uid,"tabindex":"0","draggable":_vm.sortable && _vm.listType === 'picture-card' && file.status === 'success' && !_vm.disabled},on:{"focus":function($event){_vm.focusing = true},"blur":function($event){_vm.focusing = false},"click":function($event){_vm.focusing = false},"dragstart":function($event){_vm.handleDragStart($event, file)},"dragover":function($event){_vm.handleDragOver($event, file)},"dragleave":function($event){_vm.handleDragLeave($event, file)},"drop":function($event){_vm.handleDrop($event, file)},"dragend":function($event){_vm.handleDragEnd($event, file)}}},[_vm._t("default",[_c('div',{staticClass:"el-upload-list__file"},[_c('div',{staticClass:"el-upload-list__item-name",on:{"click":function($event){_vm.onPreview(file)}}},[(['picture'].includes(_vm.listType) || ['picture-card'].includes(_vm.listType) && file.status === 'success')?_c('span',{staticClass:"el-upload-list__item-thumbnail"},[_c('el-image',{attrs:{"src":file[_vm.fileUrlAlias],"preview-src-list":_vm.handlePreview ? [] : [file[_vm.fileUrlAlias]],"fit":"contain"}},[_c('i',{staticClass:"el-image__placeholder",attrs:{"slot":"placeholder"},slot:"placeholder"}),_c('i',{staticClass:"el-image__error",attrs:{"slot":"error"},slot:"error"})])],1):(['text'].includes(_vm.listType))?_c('i',{staticClass:"el-upload-list__icon",style:(_vm.iconStyle(file.name || file[_vm.fileNameAlias]))}):_vm._e(),(['text', 'picture'].includes(_vm.listType))?_c('div',{staticClass:"el-upload-list__name"},[_c('span',{staticClass:"file-name"},[_vm._v(_vm._s(file.name || file[_vm.fileNameAlias]))])]):_vm._e()]),(['text', 'picture'].includes(_vm.listType))?_c('div',{staticClass:"el-upload-list__item-status-label"},[(file.status === 'uploading')?_c('el-progress',{staticClass:"el-upload-progress",attrs:{"percentage":file.percentage,"width":14,"stroke-width":7,"show-text":false,"type":"circle","stroke-linecap":"butt"}}):(file.status === 'success')?_c('i',{staticClass:"el-upload-success iov-icon-success"}):_vm._e()],1):(['picture-card'].includes(_vm.listType) && file.status === 'uploading')?_c('div',{staticClass:"el-upload-list__item-status-label"},[_c('el-progress',{staticClass:"el-upload-progress",attrs:{"percentage":file.percentage,"stroke-width":2,"show-text":false,"type":"line","color":"#3F57FF","define-back-color":"#F2F3F5"}}),_c('span',{staticClass:"el-upload-progress__text"},[_vm._v("上传中")])],1):_vm._e()]),(!_vm.disabled && ['text', 'picture'].includes(_vm.listType))?_c('i',{staticClass:"iov-icon-delete",on:{"click":function($event){$event.stopPropagation();_vm.$emit('remove', file)}}}):_vm._e(),(_vm.listType === 'picture-card' && file.status === 'success' && _vm.actions.length > 0)?_c('span',{staticClass:"el-upload-list__item-actions"},[(_vm.handlePreview && _vm.actions.includes('preview'))?_c('i',{staticClass:"el-upload-list__item-preview iov-icon-eye",on:{"click":function($event){$event.stopPropagation();_vm.onPreview(file)}}}):_vm._e(),(!_vm.disabled && _vm.actions.includes('update'))?_c('i',{staticClass:"el-upload-list__item-update iov-icon-update",on:{"click":function($event){$event.stopPropagation();_vm.onUpdate(file)}}}):_vm._e(),(!_vm.disabled && _vm.actions.includes('remove'))?_c('i',{staticClass:"el-upload-list__item-delete iov-icon-delete",on:{"click":function($event){$event.stopPropagation();_vm.$emit('remove', file)}}}):_vm._e()]):_vm._e()],{file:file})],2)}),0)}
245
245
  var staticRenderFns = []
246
- upload_listvue_type_template_id_4440ee8e_render._withStripped = true
246
+ upload_listvue_type_template_id_61654d05_render._withStripped = true
247
247
 
248
- // CONCATENATED MODULE: ./packages/upload/src/upload-list.vue?vue&type=template&id=4440ee8e
248
+ // CONCATENATED MODULE: ./packages/upload/src/upload-list.vue?vue&type=template&id=61654d05
249
249
 
250
250
  // EXTERNAL MODULE: external "iov-design/lib/progress"
251
251
  var progress_ = __webpack_require__(34);
@@ -408,8 +408,11 @@ function iconStyle(fileName) {
408
408
  onPreview: function onPreview(file) {
409
409
  this.handlePreview && this.handlePreview(file);
410
410
  },
411
- onUpdate: function onUpdate() {
412
- this.$parent.$refs['upload-inner'].handleClick();
411
+
412
+ // "更新"操作:调用 upload-innerhandleClick 强制弹出文件选择框,
413
+ // 并传入当前 file 标记为待替换文件,使新文件上传后替换原位置
414
+ onUpdate: function onUpdate(file) {
415
+ this.$parent.$refs['upload-inner'].handleClick(true, file);
413
416
  },
414
417
  findLiByUid: function findLiByUid(uid) {
415
418
  return this.$el.querySelector('[data-uid="' + uid + '"]');
@@ -523,7 +526,7 @@ var componentNormalizer = __webpack_require__(0);
523
526
 
524
527
  var component = Object(componentNormalizer["a" /* default */])(
525
528
  src_upload_listvue_type_script_lang_js,
526
- upload_listvue_type_template_id_4440ee8e_render,
529
+ upload_listvue_type_template_id_61654d05_render,
527
530
  staticRenderFns,
528
531
  false,
529
532
  null,
@@ -665,16 +668,16 @@ var upload_file_component = Object(componentNormalizer["a" /* default */])(
665
668
  )
666
669
 
667
670
  /* harmony default export */ var upload_file = (upload_file_component.exports);
668
- // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload-picture.vue?vue&type=template&id=39dfe1ea
669
- var upload_picturevue_type_template_id_39dfe1ea_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{class:[
671
+ // CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload-picture.vue?vue&type=template&id=43adfc78
672
+ var upload_picturevue_type_template_id_43adfc78_render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('ul',{class:[
670
673
  'el-upload-list',
671
674
  'el-upload-list--' + _vm.listType,
672
675
  { 'is-disabled': _vm.disabled }
673
676
  ],attrs:{"tag":"ul","name":"el-list"}},_vm._l((_vm.files),function(file){return _c('li',{key:file.uid,class:['el-upload-list__item', 'el-upload-list__item-' + _vm.size, 'is-' + file.status, _vm.focusing ? 'focusing' : ''],attrs:{"tabindex":"0"},on:{"focus":function($event){_vm.focusing = true},"blur":function($event){_vm.focusing = false},"click":function($event){_vm.focusing = false}}},[_vm._t("default",[_c('div',{staticClass:"el-upload-list__file"},[(file.status === 'success')?_c('div',{staticClass:"el-upload-list__item-name"},[_c('span',{staticClass:"el-upload-list__item-thumbnail"},[_c('el-image',{attrs:{"src":file[_vm.fileUrlAlias],"preview-src-list":_vm.handlePreview ? [] : [file[_vm.fileUrlAlias]],"fit":"contain"}},[_c('i',{staticClass:"el-image__placeholder",attrs:{"slot":"placeholder"},slot:"placeholder"}),_c('i',{staticClass:"el-image__error",attrs:{"slot":"error"},slot:"error"})])],1)]):_vm._e(),(file.status === 'uploading')?_c('div',{staticClass:"el-upload-list__item-status-label"},[_c('el-progress',{staticClass:"el-upload-progress",attrs:{"percentage":file.percentage,"stroke-width":2,"show-text":false,"type":"line","color":"#3F57FF","define-back-color":"#F2F3F5"}}),_c('span',{staticClass:"el-upload-progress__text"},[_vm._v("上传中")])],1):_vm._e()]),(file.status === 'success' && _vm.actions.length > 0)?_c('span',{staticClass:"el-upload-list__item-actions",on:{"click":function($event){$event.stopPropagation();}}},[(_vm.handlePreview && _vm.actions.includes('preview'))?_c('i',{staticClass:"el-upload-list__item-preview iov-icon-eye",on:{"click":function($event){$event.stopPropagation();_vm.onPreview(file)}}}):_vm._e(),(!_vm.disabled && _vm.actions.includes('update'))?_c('i',{staticClass:"el-upload-list__item-update iov-icon-update",on:{"click":function($event){$event.stopPropagation();return _vm.onUpdate($event)}}}):_vm._e(),(!_vm.disabled && _vm.actions.includes('remove'))?_c('i',{staticClass:"el-upload-list__item-delete iov-icon-delete",on:{"click":function($event){$event.stopPropagation();_vm.$emit('remove', file)}}}):_vm._e()]):_vm._e()],{file:file})],2)}),0)}
674
- var upload_picturevue_type_template_id_39dfe1ea_staticRenderFns = []
675
- upload_picturevue_type_template_id_39dfe1ea_render._withStripped = true
677
+ var upload_picturevue_type_template_id_43adfc78_staticRenderFns = []
678
+ upload_picturevue_type_template_id_43adfc78_render._withStripped = true
676
679
 
677
- // CONCATENATED MODULE: ./packages/upload/src/upload-picture.vue?vue&type=template&id=39dfe1ea
680
+ // CONCATENATED MODULE: ./packages/upload/src/upload-picture.vue?vue&type=template&id=43adfc78
678
681
 
679
682
  // CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/upload/src/upload-picture.vue?vue&type=script&lang=js
680
683
  //
@@ -775,7 +778,7 @@ upload_picturevue_type_template_id_39dfe1ea_render._withStripped = true
775
778
  this.handlePreview && this.handlePreview(file);
776
779
  },
777
780
  onUpdate: function onUpdate() {
778
- this.$parent.handleClick();
781
+ this.$parent.handleClick(true);
779
782
  }
780
783
  }
781
784
  });
@@ -791,8 +794,8 @@ upload_picturevue_type_template_id_39dfe1ea_render._withStripped = true
791
794
 
792
795
  var upload_picture_component = Object(componentNormalizer["a" /* default */])(
793
796
  src_upload_picturevue_type_script_lang_js,
794
- upload_picturevue_type_template_id_39dfe1ea_render,
795
- upload_picturevue_type_template_id_39dfe1ea_staticRenderFns,
797
+ upload_picturevue_type_template_id_43adfc78_render,
798
+ upload_picturevue_type_template_id_43adfc78_staticRenderFns,
796
799
  false,
797
800
  null,
798
801
  null,
@@ -1050,7 +1053,10 @@ var upload_dragger_component = Object(componentNormalizer["a" /* default */])(
1050
1053
  data: function data() {
1051
1054
  return {
1052
1055
  mouseover: false,
1053
- reqs: {}
1056
+ reqs: {},
1057
+ // 记录当前"更新"操作要被替换的旧文件对象。
1058
+ // 点击更新按钮时由 handleClick 设置,在 handleChange 中消费后置空。
1059
+ replacingFile: null
1054
1060
  };
1055
1061
  },
1056
1062
 
@@ -1070,12 +1076,26 @@ var upload_dragger_component = Object(componentNormalizer["a" /* default */])(
1070
1076
 
1071
1077
  if (!files) return;
1072
1078
 
1073
- if (this.drag && this.limit === 1 || this.hideUploadInput) {
1079
+ // 更新场景:需在原位置替换文件
1080
+ // - 先记录旧文件在列表中的索引(用于新文件原位插入)
1081
+ // - 中断旧文件正在进行的上传请求(如有)
1082
+ // - 从列表中移除旧文件
1083
+ var replacingIndex = -1;
1084
+ if (this.replacingFile) {
1085
+ replacingIndex = this.fileList.indexOf(this.replacingFile);
1086
+ if (replacingIndex > -1) {
1087
+ this.abort(this.replacingFile);
1088
+ this.fileList.splice(replacingIndex, 1);
1089
+ }
1090
+ this.replacingFile = null;
1091
+ } else if (this.drag && this.limit === 1 || this.hideUploadInput) {
1092
+ // 单文件拖拽上传或隐藏上传框的单图场景:直接清空列表
1074
1093
  this.fileList.length = [];
1075
1094
  }
1076
- this.uploadFiles(files);
1095
+ // 传入 replacingIndex,让新文件插入到原位置而非追加到末尾
1096
+ this.uploadFiles(files, replacingIndex);
1077
1097
  },
1078
- uploadFiles: function uploadFiles(files) {
1098
+ uploadFiles: function uploadFiles(files, replacingIndex) {
1079
1099
  var _this = this;
1080
1100
 
1081
1101
  if (this.limit && this.fileList.length + files.length > this.limit) {
@@ -1093,7 +1113,12 @@ var upload_dragger_component = Object(componentNormalizer["a" /* default */])(
1093
1113
  }
1094
1114
 
1095
1115
  postFiles.forEach(function (rawFile) {
1096
- _this.onStart(rawFile);
1116
+ // 将 replacingIndex 传给 onStart(即 ElUpload.handleStart),
1117
+ // 使新文件 splice 到原位置;replacingIndex 递增以支持多文件顺序替换
1118
+ _this.onStart(rawFile, replacingIndex);
1119
+ if (replacingIndex > -1) {
1120
+ replacingIndex++;
1121
+ }
1097
1122
  if (_this.autoUpload) _this.upload(rawFile);
1098
1123
  });
1099
1124
  },
@@ -1181,8 +1206,15 @@ var upload_dragger_component = Object(componentNormalizer["a" /* default */])(
1181
1206
  req.then(options.onSuccess, options.onError);
1182
1207
  }
1183
1208
  },
1184
- handleClick: function handleClick() {
1185
- if (!this.disabled && (this.fileList.length < this.limit || !this.limit) || this.fileList.length === 0) {
1209
+ handleClick: function handleClick(ev, file) {
1210
+ // force=true 表示绕过 limit 检查强制弹出文件选择框(用于"更新"操作)
1211
+ var force = ev === true;
1212
+ // file 存在表示本次为"更新"操作,记录要被替换的旧文件,
1213
+ // 供 handleChange 在选择新文件后移除旧文件并在原位插入新文件
1214
+ if (file) {
1215
+ this.replacingFile = file;
1216
+ }
1217
+ if (force || !this.disabled && (this.fileList.length < this.limit || !this.limit) || this.fileList.length === 0) {
1186
1218
  this.$refs.input.value = null;
1187
1219
  this.$refs.input.click();
1188
1220
  }
@@ -1459,7 +1491,7 @@ function noop() {}
1459
1491
  },
1460
1492
 
1461
1493
  methods: {
1462
- handleStart: function handleStart(rawFile) {
1494
+ handleStart: function handleStart(rawFile, replacingIndex) {
1463
1495
  rawFile.uid = Date.now() + this.tempIndex++;
1464
1496
  var file = {
1465
1497
  status: 'ready',
@@ -1479,7 +1511,14 @@ function noop() {}
1479
1511
  }
1480
1512
  }
1481
1513
 
1482
- this.uploadFiles.push(file);
1514
+ // replacingIndex > -1 表示当前为"更新"操作:
1515
+ // 新文件插入到被替换文件的原始位置,保持列表顺序不变;
1516
+ // 否则按常规追加到列表末尾
1517
+ if (replacingIndex > -1) {
1518
+ this.uploadFiles.splice(replacingIndex, 0, file);
1519
+ } else {
1520
+ this.uploadFiles.push(file);
1521
+ }
1483
1522
  this.onChange(file, this.uploadFiles);
1484
1523
  },
1485
1524
  handleProgress: function handleProgress(ev, rawFile) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iov-design",
3
- "version": "2.15.123",
3
+ "version": "2.15.124",
4
4
  "description": "A Component Library for Vue.js.",
5
5
  "main": "lib/iov-design.common.js",
6
6
  "files": [
@@ -1,12 +1,20 @@
1
1
  @font-face {
2
2
  font-family: 'iovfont'; /* Project id 4466910 */
3
- src: url('./fonts/iovfont.woff2?t=1781518231127') format('woff2'),
4
- url('./fonts/iovfont.woff?t=1781518231127') format('woff'),
5
- url('./fonts/iovfont.ttf?t=1781518231127') format('truetype');
3
+ src: url('./fonts/iovfont.woff2?t=1782987860576') format('woff2'),
4
+ url('./fonts/iovfont.woff?t=1782987860576') format('woff'),
5
+ url('./fonts/iovfont.ttf?t=1782987860576') format('truetype');
6
6
  }
7
7
 
8
8
 
9
9
 
10
+ .iov-icon-partnership:before {
11
+ content: "\e725";
12
+ }
13
+
14
+ .iov-icon-own:before {
15
+ content: "\e726";
16
+ }
17
+
10
18
  .iov-icon-ars:before {
11
19
  content: "\e723";
12
20
  }
@@ -64,6 +64,7 @@
64
64
  @mixin button-size($height, $padding-horizontal, $font-size, $border-radius) {
65
65
  padding: 0 $padding-horizontal;
66
66
  height: $height;
67
+ line-height: $height;
67
68
  font-size: $font-size;
68
69
  border-radius: $border-radius;
69
70
  .el-button__text {
@@ -182,7 +182,7 @@ export default {
182
182
  },
183
183
 
184
184
  methods: {
185
- handleStart(rawFile) {
185
+ handleStart(rawFile, replacingIndex) {
186
186
  rawFile.uid = Date.now() + this.tempIndex++;
187
187
  let file = {
188
188
  status: 'ready',
@@ -202,7 +202,14 @@ export default {
202
202
  }
203
203
  }
204
204
 
205
- this.uploadFiles.push(file);
205
+ // replacingIndex > -1 表示当前为"更新"操作:
206
+ // 新文件插入到被替换文件的原始位置,保持列表顺序不变;
207
+ // 否则按常规追加到列表末尾
208
+ if (replacingIndex > -1) {
209
+ this.uploadFiles.splice(replacingIndex, 0, file);
210
+ } else {
211
+ this.uploadFiles.push(file);
212
+ }
206
213
  this.onChange(file, this.uploadFiles);
207
214
  },
208
215
  handleProgress(ev, rawFile) {
@@ -76,7 +76,7 @@
76
76
  <i class="iov-icon-delete" v-if="!disabled && ['text', 'picture'].includes(listType)" @click.stop="$emit('remove', file)"></i>
77
77
  <span class="el-upload-list__item-actions" v-if="listType === 'picture-card' && file.status === 'success' && actions.length > 0">
78
78
  <i v-if="handlePreview && actions.includes('preview')" @click.stop="onPreview(file)" class="el-upload-list__item-preview iov-icon-eye"></i>
79
- <i v-if="!disabled && actions.includes('update')" class="el-upload-list__item-update iov-icon-update" @click.stop="onUpdate"></i>
79
+ <i v-if="!disabled && actions.includes('update')" class="el-upload-list__item-update iov-icon-update" @click.stop="onUpdate(file)"></i>
80
80
  <i v-if="!disabled && actions.includes('remove')" class="el-upload-list__item-delete iov-icon-delete" @click.stop="$emit('remove', file)"></i>
81
81
  </span>
82
82
  </slot>
@@ -138,8 +138,10 @@
138
138
  onPreview(file) {
139
139
  this.handlePreview && this.handlePreview(file);
140
140
  },
141
- onUpdate() {
142
- this.$parent.$refs['upload-inner'].handleClick();
141
+ // "更新"操作:调用 upload-inner 的 handleClick 强制弹出文件选择框,
142
+ // 并传入当前 file 标记为待替换文件,使新文件上传后替换原位置
143
+ onUpdate(file) {
144
+ this.$parent.$refs['upload-inner'].handleClick(true, file);
143
145
  },
144
146
  findLiByUid(uid) {
145
147
  return this.$el.querySelector(`[data-uid="${uid}"]`);
@@ -95,7 +95,7 @@
95
95
  this.handlePreview && this.handlePreview(file);
96
96
  },
97
97
  onUpdate() {
98
- this.$parent.handleClick();
98
+ this.$parent.handleClick(true);
99
99
  }
100
100
  }
101
101
  };
@@ -53,7 +53,10 @@ export default {
53
53
  data() {
54
54
  return {
55
55
  mouseover: false,
56
- reqs: {}
56
+ reqs: {},
57
+ // 记录当前"更新"操作要被替换的旧文件对象。
58
+ // 点击更新按钮时由 handleClick 设置,在 handleChange 中消费后置空。
59
+ replacingFile: null
57
60
  };
58
61
  },
59
62
 
@@ -75,12 +78,26 @@ export default {
75
78
 
76
79
  if (!files) return;
77
80
 
78
- if (this.drag && this.limit === 1 || this.hideUploadInput) {
81
+ // 更新场景:需在原位置替换文件
82
+ // - 先记录旧文件在列表中的索引(用于新文件原位插入)
83
+ // - 中断旧文件正在进行的上传请求(如有)
84
+ // - 从列表中移除旧文件
85
+ let replacingIndex = -1;
86
+ if (this.replacingFile) {
87
+ replacingIndex = this.fileList.indexOf(this.replacingFile);
88
+ if (replacingIndex > -1) {
89
+ this.abort(this.replacingFile);
90
+ this.fileList.splice(replacingIndex, 1);
91
+ }
92
+ this.replacingFile = null;
93
+ } else if (this.drag && this.limit === 1 || this.hideUploadInput) {
94
+ // 单文件拖拽上传或隐藏上传框的单图场景:直接清空列表
79
95
  this.fileList.length = [];
80
96
  }
81
- this.uploadFiles(files);
97
+ // 传入 replacingIndex,让新文件插入到原位置而非追加到末尾
98
+ this.uploadFiles(files, replacingIndex);
82
99
  },
83
- uploadFiles(files) {
100
+ uploadFiles(files, replacingIndex) {
84
101
  if (this.limit && this.fileList.length + files.length > this.limit) {
85
102
  this.onExceed && this.onExceed(files, this.fileList);
86
103
  return;
@@ -92,7 +109,10 @@ export default {
92
109
  if (postFiles.length === 0) { return; }
93
110
 
94
111
  postFiles.forEach(rawFile => {
95
- this.onStart(rawFile);
112
+ // 将 replacingIndex 传给 onStart(即 ElUpload.handleStart),
113
+ // 使新文件 splice 到原位置;replacingIndex 递增以支持多文件顺序替换
114
+ this.onStart(rawFile, replacingIndex);
115
+ if (replacingIndex > -1) { replacingIndex++; }
96
116
  if (this.autoUpload) this.upload(rawFile);
97
117
  });
98
118
  },
@@ -174,8 +194,15 @@ export default {
174
194
  req.then(options.onSuccess, options.onError);
175
195
  }
176
196
  },
177
- handleClick() {
178
- if (!this.disabled && (this.fileList.length < this.limit || !this.limit) || this.fileList.length === 0) {
197
+ handleClick(ev, file) {
198
+ // force=true 表示绕过 limit 检查强制弹出文件选择框(用于"更新"操作)
199
+ const force = ev === true;
200
+ // file 存在表示本次为"更新"操作,记录要被替换的旧文件,
201
+ // 供 handleChange 在选择新文件后移除旧文件并在原位插入新文件
202
+ if (file) {
203
+ this.replacingFile = file;
204
+ }
205
+ if (force || (!this.disabled && (this.fileList.length < this.limit || !this.limit)) || this.fileList.length === 0) {
179
206
  this.$refs.input.value = null;
180
207
  this.$refs.input.click();
181
208
  }
package/src/index.js CHANGED
@@ -217,7 +217,7 @@ if (typeof window !== 'undefined' && window.Vue) {
217
217
  }
218
218
 
219
219
  export default {
220
- version: '2.15.123',
220
+ version: '2.15.124',
221
221
  locale: locale.use,
222
222
  i18n: locale.i18n,
223
223
  install,