@hw-component/form 1.9.65 → 1.9.66
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.
|
@@ -58,6 +58,13 @@ var useChange = function useChange(_ref) {
|
|
|
58
58
|
onChange: onChange,
|
|
59
59
|
value: value
|
|
60
60
|
});
|
|
61
|
+
var checkGo = function checkGo(errList) {
|
|
62
|
+
var len = errList.length;
|
|
63
|
+
if (len) {
|
|
64
|
+
message.error(errList[0].message);
|
|
65
|
+
}
|
|
66
|
+
return !(maxCount === 1 && len > 0);
|
|
67
|
+
};
|
|
61
68
|
var _useRequest = useRequest(/*#__PURE__*/function () {
|
|
62
69
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
63
70
|
var fileList, _matchFile, addFile, newFileList, errList, changeFile;
|
|
@@ -73,9 +80,12 @@ var useChange = function useChange(_ref) {
|
|
|
73
80
|
return _context.abrupt("return");
|
|
74
81
|
case 4:
|
|
75
82
|
_matchFile = matchFile(fileList, value, exFiles, maxSize), addFile = _matchFile.addFile, newFileList = _matchFile.fileList, errList = _matchFile.errList;
|
|
76
|
-
if (errList
|
|
77
|
-
|
|
83
|
+
if (checkGo(errList)) {
|
|
84
|
+
_context.next = 7;
|
|
85
|
+
break;
|
|
78
86
|
}
|
|
87
|
+
return _context.abrupt("return");
|
|
88
|
+
case 7:
|
|
79
89
|
changeFile = newFileList === null || newFileList === void 0 ? void 0 : newFileList.map(function (item) {
|
|
80
90
|
return _objectSpread({
|
|
81
91
|
thumbUrl: thumbUrl
|
|
@@ -83,7 +93,7 @@ var useChange = function useChange(_ref) {
|
|
|
83
93
|
});
|
|
84
94
|
onChange === null || onChange === void 0 || onChange(changeFile);
|
|
85
95
|
customRequest(addFile);
|
|
86
|
-
case
|
|
96
|
+
case 10:
|
|
87
97
|
case "end":
|
|
88
98
|
return _context.stop();
|
|
89
99
|
}
|
|
@@ -59,6 +59,13 @@ var useChange = function useChange(_ref) {
|
|
|
59
59
|
onChange: onChange,
|
|
60
60
|
value: value
|
|
61
61
|
});
|
|
62
|
+
var checkGo = function checkGo(errList) {
|
|
63
|
+
var len = errList.length;
|
|
64
|
+
if (len) {
|
|
65
|
+
antd.message.error(errList[0].message);
|
|
66
|
+
}
|
|
67
|
+
return !(maxCount === 1 && len > 0);
|
|
68
|
+
};
|
|
62
69
|
var _useRequest = ahooks.useRequest(/*#__PURE__*/function () {
|
|
63
70
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2) {
|
|
64
71
|
var fileList, _matchFile, addFile, newFileList, errList, changeFile;
|
|
@@ -74,9 +81,12 @@ var useChange = function useChange(_ref) {
|
|
|
74
81
|
return _context.abrupt("return");
|
|
75
82
|
case 4:
|
|
76
83
|
_matchFile = matchFile(fileList, value, exFiles, maxSize), addFile = _matchFile.addFile, newFileList = _matchFile.fileList, errList = _matchFile.errList;
|
|
77
|
-
if (errList
|
|
78
|
-
|
|
84
|
+
if (checkGo(errList)) {
|
|
85
|
+
_context.next = 7;
|
|
86
|
+
break;
|
|
79
87
|
}
|
|
88
|
+
return _context.abrupt("return");
|
|
89
|
+
case 7:
|
|
80
90
|
changeFile = newFileList === null || newFileList === void 0 ? void 0 : newFileList.map(function (item) {
|
|
81
91
|
return _objectSpread({
|
|
82
92
|
thumbUrl: thumbUrl
|
|
@@ -84,7 +94,7 @@ var useChange = function useChange(_ref) {
|
|
|
84
94
|
});
|
|
85
95
|
onChange === null || onChange === void 0 || onChange(changeFile);
|
|
86
96
|
customRequest$1(addFile);
|
|
87
|
-
case
|
|
97
|
+
case 10:
|
|
88
98
|
case "end":
|
|
89
99
|
return _context.stop();
|
|
90
100
|
}
|
package/package.json
CHANGED
|
@@ -10,7 +10,6 @@ const checkFile = (item: UploadFile, oldFile: UploadFile[] = []) => {
|
|
|
10
10
|
return item.uid !== oldItem.uid;
|
|
11
11
|
});
|
|
12
12
|
};
|
|
13
|
-
|
|
14
13
|
const matchFile = (
|
|
15
14
|
newFile: UploadFile[],
|
|
16
15
|
oldFile: UploadFile[] = [],
|
|
@@ -53,7 +52,14 @@ export const useChange = ({
|
|
|
53
52
|
thumbUrl,
|
|
54
53
|
}: IUpLoadProps) => {
|
|
55
54
|
const customRequest = useCustomRequest({ request, onChange, value });
|
|
55
|
+
const checkGo=(errList:Error[])=>{
|
|
56
|
+
const len=errList.length;
|
|
57
|
+
if (len) {
|
|
58
|
+
message.error(errList[0].message);
|
|
59
|
+
}
|
|
60
|
+
return !(maxCount === 1 && len > 0);//为1时存在错误不调用onChange
|
|
56
61
|
|
|
62
|
+
}
|
|
57
63
|
const { run } = useRequest(
|
|
58
64
|
async ({ fileList }: UploadChangeParam<UploadFile>) => {
|
|
59
65
|
if (fileList.length > maxCount) {
|
|
@@ -65,8 +71,8 @@ export const useChange = ({
|
|
|
65
71
|
fileList: newFileList,
|
|
66
72
|
errList,
|
|
67
73
|
} = matchFile(fileList, value, exFiles, maxSize);
|
|
68
|
-
if (errList
|
|
69
|
-
|
|
74
|
+
if (!checkGo(errList)) {
|
|
75
|
+
return;
|
|
70
76
|
}
|
|
71
77
|
const changeFile = newFileList?.map((item) => {
|
|
72
78
|
return {
|