iov-pro-components 0.0.117 → 0.0.119

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.
@@ -28442,6 +28442,16 @@ var script = {
28442
28442
  default: function _default() {
28443
28443
  return ['preview', 'update', 'remove'];
28444
28444
  }
28445
+ },
28446
+ // 是否开启拖拽排序
28447
+ sortable: {
28448
+ type: Boolean,
28449
+ default: false
28450
+ },
28451
+ // 拖拽排序完成后的回调
28452
+ onSort: {
28453
+ type: Function,
28454
+ default: null
28445
28455
  }
28446
28456
  },
28447
28457
  data: function data() {
@@ -28537,13 +28547,18 @@ var script = {
28537
28547
  * ElUpload需要的文件列表
28538
28548
  */
28539
28549
  fileList: function fileList() {
28540
- var _this$uploadFileList;
28550
+ var _this$uploadFileList,
28551
+ _this = this;
28541
28552
  // 如果有上传文件
28542
28553
  if (((_this$uploadFileList = this.uploadFileList) === null || _this$uploadFileList === void 0 ? void 0 : _this$uploadFileList.length) > 0) {
28543
28554
  return this.uploadFileList;
28544
28555
  }
28545
28556
  // 返回当前双向绑定的数据
28546
- return this.modelValue;
28557
+ return this.modelValue.map(function (val) {
28558
+ return _objectSpread2({
28559
+ uid: val[_this.uploadAlias.uuid] || val[_this.uploadAlias.url] || ''
28560
+ }, val);
28561
+ });
28547
28562
  }
28548
28563
  },
28549
28564
  watch: {
@@ -28711,7 +28726,9 @@ var script = {
28711
28726
  onDeleteFile: function onDeleteFile(file) {
28712
28727
  // 过滤当前文件列表
28713
28728
  var fileList = this.modelValue.filter(function (f) {
28714
- return f !== file;
28729
+ return !Object.keys(f).every(function (k) {
28730
+ return f[k] === file[k];
28731
+ });
28715
28732
  });
28716
28733
  // 更新文件列表
28717
28734
  this.onChangeModelValue(fileList);
@@ -28724,7 +28741,7 @@ var script = {
28724
28741
  * @time 2025-08-01 16:37:30
28725
28742
  */
28726
28743
  onUploadFile: function onUploadFile(resp, file, fileList) {
28727
- var _this = this;
28744
+ var _this2 = this;
28728
28745
  // 标记当前没在上传
28729
28746
  this.uploading = false;
28730
28747
  // 如果接口请求失败
@@ -28757,9 +28774,9 @@ var script = {
28757
28774
  }) ? [] : fileList;
28758
28775
  // 等待数据双向绑定成功后触发表单事件
28759
28776
  this.$nextTick(function () {
28760
- var _this$$parent, _this$$parent2;
28777
+ var _this2$$parent, _this2$$parent2;
28761
28778
  // 触发表单校验
28762
- ((_this$$parent = _this.$parent) === null || _this$$parent === void 0 ? void 0 : _this$$parent.$emit) && ((_this$$parent2 = _this.$parent) === null || _this$$parent2 === void 0 ? void 0 : _this$$parent2.$emit('el.form.change'));
28779
+ ((_this2$$parent = _this2.$parent) === null || _this2$$parent === void 0 ? void 0 : _this2$$parent.$emit) && ((_this2$$parent2 = _this2.$parent) === null || _this2$$parent2 === void 0 ? void 0 : _this2$$parent2.$emit('el.form.change'));
28763
28780
  });
28764
28781
  },
28765
28782
  /**
@@ -28768,7 +28785,7 @@ var script = {
28768
28785
  * @time 2025-08-04 13:54:07
28769
28786
  */
28770
28787
  onChangeModelValue: function onChangeModelValue(fileList) {
28771
- var _this2 = this;
28788
+ var _this3 = this;
28772
28789
  var transformUploadRespData = this.responseTransform || function (respData) {
28773
28790
  return respData;
28774
28791
  };
@@ -28777,7 +28794,7 @@ var script = {
28777
28794
  var _item$response;
28778
28795
  // 转换后的结果
28779
28796
  var transformResponse = item !== null && item !== void 0 && (_item$response = item.response) !== null && _item$response !== void 0 && _item$response.data ? transformUploadRespData(item.response.data) : {};
28780
- return _defineProperty$2(_defineProperty$2(_defineProperty$2({}, _this2.uploadAlias.fileName, item.raw ? transformResponse === null || transformResponse === void 0 ? void 0 : transformResponse.fileName : item[_this2.uploadAlias.fileName]), _this2.uploadAlias.uuid, item.raw ? transformResponse === null || transformResponse === void 0 ? void 0 : transformResponse.uuid : item[_this2.uploadAlias.uuid]), _this2.uploadAlias.url, item.raw ? transformResponse === null || transformResponse === void 0 ? void 0 : transformResponse.accessUrl : item[_this2.uploadAlias.url]);
28797
+ return _defineProperty$2(_defineProperty$2(_defineProperty$2({}, _this3.uploadAlias.fileName, item.raw ? transformResponse === null || transformResponse === void 0 ? void 0 : transformResponse.fileName : item[_this3.uploadAlias.fileName]), _this3.uploadAlias.uuid, item.raw ? transformResponse === null || transformResponse === void 0 ? void 0 : transformResponse.uuid : item[_this3.uploadAlias.uuid]), _this3.uploadAlias.url, item.raw ? transformResponse === null || transformResponse === void 0 ? void 0 : transformResponse.accessUrl : item[_this3.uploadAlias.url]);
28781
28798
  });
28782
28799
  // 双向绑定列表数据
28783
28800
  this.onEmitValue(list, fileList);
@@ -28789,7 +28806,7 @@ var script = {
28789
28806
  * @time 2025-11-03 13:47:01
28790
28807
  */
28791
28808
  onEmitValue: function onEmitValue(list, fileList) {
28792
- var _this3 = this;
28809
+ var _this4 = this;
28793
28810
  // 当前需要双向绑定的数据
28794
28811
  var value = [];
28795
28812
  // 如果需要格式化数据
@@ -28807,7 +28824,7 @@ var script = {
28807
28824
  case 'Object':
28808
28825
  // 如果当前传入的是对象
28809
28826
  value = list[0] ? fields.reduce(function (memo, key) {
28810
- memo[key] = list[0][_this3.uploadAlias[key]];
28827
+ memo[key] = list[0][_this4.uploadAlias[key]];
28811
28828
  return memo;
28812
28829
  }, {}) : null;
28813
28830
  break;
@@ -28815,7 +28832,7 @@ var script = {
28815
28832
  // 如果当前传入的是数组
28816
28833
  value = list ? list.map(function (item) {
28817
28834
  return fields.reduce(function (memo, key) {
28818
- memo[key] = item[_this3.uploadAlias[key]];
28835
+ memo[key] = item[_this4.uploadAlias[key]];
28819
28836
  return memo;
28820
28837
  }, {});
28821
28838
  }) : [];
@@ -28841,7 +28858,7 @@ var script = {
28841
28858
  // 如果有表单项
28842
28859
  if (this.elFormItem) {
28843
28860
  this.$nextTick(function () {
28844
- return _this3.elFormItem.validate('change');
28861
+ return _this4.elFormItem.validate('change');
28845
28862
  });
28846
28863
  }
28847
28864
  },
@@ -28851,7 +28868,7 @@ var script = {
28851
28868
  * @time 2023-08-19 09:32:38
28852
28869
  */
28853
28870
  onUploadError: function onUploadError(file) {
28854
- var _this4 = this;
28871
+ var _this5 = this;
28855
28872
  // 标记当前没在上传
28856
28873
  this.uploading = false;
28857
28874
  // 文件上传失败提示
@@ -28861,7 +28878,7 @@ var script = {
28861
28878
  // 如果有表单项
28862
28879
  if (this.elFormItem) {
28863
28880
  this.$nextTick(function () {
28864
- return _this4.elFormItem.validate('change');
28881
+ return _this5.elFormItem.validate('change');
28865
28882
  });
28866
28883
  }
28867
28884
  },
@@ -28912,6 +28929,41 @@ var script = {
28912
28929
  */
28913
28930
  onExceed: function onExceed() {
28914
28931
  this.$message.error("\u4E0A\u4F20\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7".concat(this.limit, "\u4E2A"));
28932
+ },
28933
+ /**
28934
+ * 排序方法
28935
+ * @param {Object} sortInfo 排序信息
28936
+ * @time 2026-05-19 16:44:44
28937
+ */
28938
+ onSortEnd: function onSortEnd(sortInfo) {
28939
+ // 排序字段
28940
+ var oldIndex = sortInfo.oldIndex,
28941
+ newIndex = sortInfo.newIndex,
28942
+ file = sortInfo.file,
28943
+ targetFile = sortInfo.targetFile,
28944
+ files = sortInfo.files;
28945
+ // 如果有排序回调
28946
+ if (this.onSort) {
28947
+ // 执行排序回调
28948
+ this.onSort({
28949
+ oldIndex: oldIndex,
28950
+ newIndex: newIndex,
28951
+ file: file,
28952
+ targetFile: targetFile,
28953
+ files: files
28954
+ });
28955
+ } else {
28956
+ // 开始双向绑定
28957
+ this.onEmitValue(files.map(function (f) {
28958
+ // 复制当前文件
28959
+ var fileClone = _objectSpread2({}, f);
28960
+ // 去掉status和uid字段
28961
+ delete fileClone.status;
28962
+ delete fileClone.uid;
28963
+ // 直接返回
28964
+ return fileClone;
28965
+ }), files);
28966
+ }
28915
28967
  }
28916
28968
  }
28917
28969
  };
@@ -28943,6 +28995,8 @@ var __vue_render__ = function __vue_render__() {
28943
28995
  "on-exceed": _vm.onExceed,
28944
28996
  "on-preview": _vm.onPreviewFile,
28945
28997
  "on-remove": _vm.onDeleteFile,
28998
+ sortable: _vm.sortable,
28999
+ "on-sort": _vm.onSortEnd,
28946
29000
  "before-upload": _vm.onBeforeUpload,
28947
29001
  disabled: _vm.disabled,
28948
29002
  "file-name-alias": _vm.uploadAlias.fileName,
@@ -29195,7 +29249,7 @@ var install = function install(Vue, componentConfig) {
29195
29249
  };
29196
29250
  var index = {
29197
29251
  install: install,
29198
- version: '0.0.117',
29252
+ version: '0.0.119',
29199
29253
  BackTop: __vue_component__$K,
29200
29254
  ColorPicker: __vue_component__$E,
29201
29255
  ColumnTooltip: __vue_component__$D,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "iov-pro-components",
3
- "version": "0.0.117",
3
+ "version": "0.0.119",
4
4
  "description": "IOV Pro Components for Vue.js",
5
5
  "main": "lib/iov-pro-components.min.js",
6
6
  "files": [
@@ -44,7 +44,7 @@
44
44
  "core-js": "^3.8.3",
45
45
  "eslint": "7.32.0",
46
46
  "eslint-plugin-vue": "8.0.3",
47
- "iov-design": "^2.15.106",
47
+ "iov-design": "^2.15.115",
48
48
  "jest": "^29.7.0",
49
49
  "jest-environment-jsdom": "^29.7.0",
50
50
  "jest-serializer-vue": "^3.1.0",