iov-pro-components 0.0.117 → 0.0.118

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: {
@@ -28724,7 +28739,7 @@ var script = {
28724
28739
  * @time 2025-08-01 16:37:30
28725
28740
  */
28726
28741
  onUploadFile: function onUploadFile(resp, file, fileList) {
28727
- var _this = this;
28742
+ var _this2 = this;
28728
28743
  // 标记当前没在上传
28729
28744
  this.uploading = false;
28730
28745
  // 如果接口请求失败
@@ -28757,9 +28772,9 @@ var script = {
28757
28772
  }) ? [] : fileList;
28758
28773
  // 等待数据双向绑定成功后触发表单事件
28759
28774
  this.$nextTick(function () {
28760
- var _this$$parent, _this$$parent2;
28775
+ var _this2$$parent, _this2$$parent2;
28761
28776
  // 触发表单校验
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'));
28777
+ ((_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
28778
  });
28764
28779
  },
28765
28780
  /**
@@ -28768,7 +28783,7 @@ var script = {
28768
28783
  * @time 2025-08-04 13:54:07
28769
28784
  */
28770
28785
  onChangeModelValue: function onChangeModelValue(fileList) {
28771
- var _this2 = this;
28786
+ var _this3 = this;
28772
28787
  var transformUploadRespData = this.responseTransform || function (respData) {
28773
28788
  return respData;
28774
28789
  };
@@ -28777,7 +28792,7 @@ var script = {
28777
28792
  var _item$response;
28778
28793
  // 转换后的结果
28779
28794
  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]);
28795
+ 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
28796
  });
28782
28797
  // 双向绑定列表数据
28783
28798
  this.onEmitValue(list, fileList);
@@ -28789,7 +28804,7 @@ var script = {
28789
28804
  * @time 2025-11-03 13:47:01
28790
28805
  */
28791
28806
  onEmitValue: function onEmitValue(list, fileList) {
28792
- var _this3 = this;
28807
+ var _this4 = this;
28793
28808
  // 当前需要双向绑定的数据
28794
28809
  var value = [];
28795
28810
  // 如果需要格式化数据
@@ -28807,7 +28822,7 @@ var script = {
28807
28822
  case 'Object':
28808
28823
  // 如果当前传入的是对象
28809
28824
  value = list[0] ? fields.reduce(function (memo, key) {
28810
- memo[key] = list[0][_this3.uploadAlias[key]];
28825
+ memo[key] = list[0][_this4.uploadAlias[key]];
28811
28826
  return memo;
28812
28827
  }, {}) : null;
28813
28828
  break;
@@ -28815,7 +28830,7 @@ var script = {
28815
28830
  // 如果当前传入的是数组
28816
28831
  value = list ? list.map(function (item) {
28817
28832
  return fields.reduce(function (memo, key) {
28818
- memo[key] = item[_this3.uploadAlias[key]];
28833
+ memo[key] = item[_this4.uploadAlias[key]];
28819
28834
  return memo;
28820
28835
  }, {});
28821
28836
  }) : [];
@@ -28841,7 +28856,7 @@ var script = {
28841
28856
  // 如果有表单项
28842
28857
  if (this.elFormItem) {
28843
28858
  this.$nextTick(function () {
28844
- return _this3.elFormItem.validate('change');
28859
+ return _this4.elFormItem.validate('change');
28845
28860
  });
28846
28861
  }
28847
28862
  },
@@ -28851,7 +28866,7 @@ var script = {
28851
28866
  * @time 2023-08-19 09:32:38
28852
28867
  */
28853
28868
  onUploadError: function onUploadError(file) {
28854
- var _this4 = this;
28869
+ var _this5 = this;
28855
28870
  // 标记当前没在上传
28856
28871
  this.uploading = false;
28857
28872
  // 文件上传失败提示
@@ -28861,7 +28876,7 @@ var script = {
28861
28876
  // 如果有表单项
28862
28877
  if (this.elFormItem) {
28863
28878
  this.$nextTick(function () {
28864
- return _this4.elFormItem.validate('change');
28879
+ return _this5.elFormItem.validate('change');
28865
28880
  });
28866
28881
  }
28867
28882
  },
@@ -28912,6 +28927,41 @@ var script = {
28912
28927
  */
28913
28928
  onExceed: function onExceed() {
28914
28929
  this.$message.error("\u4E0A\u4F20\u6587\u4EF6\u4E0D\u80FD\u8D85\u8FC7".concat(this.limit, "\u4E2A"));
28930
+ },
28931
+ /**
28932
+ * 排序方法
28933
+ * @param {Object} sortInfo 排序信息
28934
+ * @time 2026-05-19 16:44:44
28935
+ */
28936
+ onSortEnd: function onSortEnd(sortInfo) {
28937
+ // 排序字段
28938
+ var oldIndex = sortInfo.oldIndex,
28939
+ newIndex = sortInfo.newIndex,
28940
+ file = sortInfo.file,
28941
+ targetFile = sortInfo.targetFile,
28942
+ files = sortInfo.files;
28943
+ // 如果有排序回调
28944
+ if (this.onSort) {
28945
+ // 执行排序回调
28946
+ this.onSort({
28947
+ oldIndex: oldIndex,
28948
+ newIndex: newIndex,
28949
+ file: file,
28950
+ targetFile: targetFile,
28951
+ files: files
28952
+ });
28953
+ } else {
28954
+ // 开始双向绑定
28955
+ this.onEmitValue(files.map(function (f) {
28956
+ // 复制当前文件
28957
+ var fileClone = _objectSpread2({}, f);
28958
+ // 去掉status和uid字段
28959
+ delete fileClone.status;
28960
+ delete fileClone.uid;
28961
+ // 直接返回
28962
+ return fileClone;
28963
+ }), files);
28964
+ }
28915
28965
  }
28916
28966
  }
28917
28967
  };
@@ -28943,6 +28993,8 @@ var __vue_render__ = function __vue_render__() {
28943
28993
  "on-exceed": _vm.onExceed,
28944
28994
  "on-preview": _vm.onPreviewFile,
28945
28995
  "on-remove": _vm.onDeleteFile,
28996
+ sortable: _vm.sortable,
28997
+ "on-sort": _vm.onSortEnd,
28946
28998
  "before-upload": _vm.onBeforeUpload,
28947
28999
  disabled: _vm.disabled,
28948
29000
  "file-name-alias": _vm.uploadAlias.fileName,
@@ -29195,7 +29247,7 @@ var install = function install(Vue, componentConfig) {
29195
29247
  };
29196
29248
  var index = {
29197
29249
  install: install,
29198
- version: '0.0.117',
29250
+ version: '0.0.118',
29199
29251
  BackTop: __vue_component__$K,
29200
29252
  ColorPicker: __vue_component__$E,
29201
29253
  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.118",
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",