@hw-component/form 0.0.2-beta-v1 → 0.0.2-beta-v2
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/es/Upload/index.js
CHANGED
|
@@ -86,7 +86,8 @@ var Index = function Index(_ref, ref) {
|
|
|
86
86
|
var _item$name = item.name,
|
|
87
87
|
name = _item$name === void 0 ? "" : _item$name;
|
|
88
88
|
var initFileList = initValue[name] || [];
|
|
89
|
-
var
|
|
89
|
+
var relInitFileList = typeof initFileList === "string" ? [initFileList] : initFileList;
|
|
90
|
+
var fileList = _mapInstanceProperty(relInitFileList).call(relInitFileList, function (url, index) {
|
|
90
91
|
return {
|
|
91
92
|
name: url,
|
|
92
93
|
response: {
|
|
@@ -107,7 +108,7 @@ var Index = function Index(_ref, ref) {
|
|
|
107
108
|
var urls = _mapInstanceProperty(itemVal).call(itemVal, function (fileItem) {
|
|
108
109
|
return fileItem.response.url;
|
|
109
110
|
});
|
|
110
|
-
return _defineProperty({}, valueName, urls);
|
|
111
|
+
return _defineProperty({}, valueName, maxCount === 1 ? urls[0] : urls);
|
|
111
112
|
}
|
|
112
113
|
}
|
|
113
114
|
});
|
package/lib/Upload/index.js
CHANGED
|
@@ -89,7 +89,8 @@ var Index = function Index(_ref, ref) {
|
|
|
89
89
|
var _item$name = item.name,
|
|
90
90
|
name = _item$name === void 0 ? "" : _item$name;
|
|
91
91
|
var initFileList = initValue[name] || [];
|
|
92
|
-
var
|
|
92
|
+
var relInitFileList = typeof initFileList === "string" ? [initFileList] : initFileList;
|
|
93
|
+
var fileList = _mapInstanceProperty(relInitFileList).call(relInitFileList, function (url, index) {
|
|
93
94
|
return {
|
|
94
95
|
name: url,
|
|
95
96
|
response: {
|
|
@@ -110,7 +111,7 @@ var Index = function Index(_ref, ref) {
|
|
|
110
111
|
var urls = _mapInstanceProperty(itemVal).call(itemVal, function (fileItem) {
|
|
111
112
|
return fileItem.response.url;
|
|
112
113
|
});
|
|
113
|
-
return _defineProperty({}, valueName, urls);
|
|
114
|
+
return _defineProperty({}, valueName, maxCount === 1 ? urls[0] : urls);
|
|
114
115
|
}
|
|
115
116
|
}
|
|
116
117
|
});
|
package/package.json
CHANGED
|
@@ -61,7 +61,8 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
|
|
|
61
61
|
inputValue: (item, initValue) => {
|
|
62
62
|
const { name = "" } = item;
|
|
63
63
|
const initFileList = initValue[name] || [];
|
|
64
|
-
const
|
|
64
|
+
const relInitFileList=typeof initFileList==="string"?[initFileList]:initFileList;
|
|
65
|
+
const fileList = relInitFileList.map((url, index) => {
|
|
65
66
|
return {
|
|
66
67
|
name: url,
|
|
67
68
|
response: {
|
|
@@ -83,7 +84,7 @@ const Index: React.ForwardRefRenderFunction<IUploadRefModal, IUpLoadProps> = (
|
|
|
83
84
|
return fileItem.response.url;
|
|
84
85
|
});
|
|
85
86
|
return {
|
|
86
|
-
[valueName]: urls,
|
|
87
|
+
[valueName]: maxCount===1?urls[0]:urls,
|
|
87
88
|
};
|
|
88
89
|
},
|
|
89
90
|
},
|