@ecoding/components.antd 0.2.30 → 0.2.32
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.
|
@@ -41,7 +41,7 @@ const C = ({ columns, rules, name, hideOperation, operation, i18n }) => {
|
|
|
41
41
|
" ",
|
|
42
42
|
column.title));
|
|
43
43
|
}
|
|
44
|
-
return React.createElement("th", { style: Object.assign({}, thStyle, { width:
|
|
44
|
+
return React.createElement("th", { style: Object.assign({}, thStyle, { width: column.width || 200 }) }, column.title);
|
|
45
45
|
}),
|
|
46
46
|
hideOperation ? null : operation ? (React.createElement("th", { style: Object.assign({}, thStyle, { width: operation.width || 150, right: 0, position: "sticky" }) }, operation.title)) : (React.createElement("th", { style: Object.assign({}, thStyle, { width: 150, right: 0, position: "sticky" }) }, i18n ? i18n.$t("global.operation") : "操作")))),
|
|
47
47
|
React.createElement("tbody", null, fields.map((field, index) => {
|
|
@@ -51,16 +51,21 @@ const SingleFileUpload = (props) => {
|
|
|
51
51
|
return props.action();
|
|
52
52
|
}, [props.actionParams]);
|
|
53
53
|
const handleChange = (info, type) => {
|
|
54
|
+
var _a, _b;
|
|
54
55
|
switch (info.file.status) {
|
|
55
56
|
case 'uploading':
|
|
56
57
|
Loading.show();
|
|
57
58
|
break;
|
|
58
59
|
case 'done':
|
|
59
60
|
Loading.hide();
|
|
60
|
-
const response = info.file.response;
|
|
61
|
+
const response = info.file.response || {};
|
|
61
62
|
const file = info.file;
|
|
62
|
-
|
|
63
|
-
|
|
63
|
+
const data = response.data || response.model;
|
|
64
|
+
if (response.code === 200 ||
|
|
65
|
+
response.code === 0 ||
|
|
66
|
+
response.success ||
|
|
67
|
+
response.successed) {
|
|
68
|
+
const tempObj = Object.assign({ name: file.name, url: data.url }, props.extraData);
|
|
64
69
|
const tempRes = infos.concat([]);
|
|
65
70
|
tempRes.push(tempObj);
|
|
66
71
|
setInfos(tempRes);
|
|
@@ -84,7 +89,7 @@ const SingleFileUpload = (props) => {
|
|
|
84
89
|
Toast.error({
|
|
85
90
|
mask: true,
|
|
86
91
|
title: info.file.response
|
|
87
|
-
? `${info.file.name}-${info.file.response.msg}` || `${info.file.name}-${info.file.response.message}`
|
|
92
|
+
? `${info.file.name}-${(_a = info.file.response) === null || _a === void 0 ? void 0 : _a.msg}` || `${info.file.name}-${(_b = info.file.response) === null || _b === void 0 ? void 0 : _b.message}`
|
|
88
93
|
: `${info.file.name}-服务出错,文件上传失败`
|
|
89
94
|
});
|
|
90
95
|
props.onError && props.onError(info.file);
|
|
@@ -128,6 +133,7 @@ SingleFileUpload.defaultProps = {
|
|
|
128
133
|
openFileDialogOnClick: true,
|
|
129
134
|
icon: true,
|
|
130
135
|
data: {},
|
|
136
|
+
extraData: {},
|
|
131
137
|
maxCount: 10,
|
|
132
138
|
headers: undefined,
|
|
133
139
|
buttonText: '点击上传',
|
|
@@ -30,12 +30,16 @@ const SingleFileUpload = (props) => {
|
|
|
30
30
|
case "uploading":
|
|
31
31
|
break;
|
|
32
32
|
case "done":
|
|
33
|
-
const response = info.file.response;
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
const response = info.file.response || {};
|
|
34
|
+
const data = response.data || response.model;
|
|
35
|
+
if (response.code === 200 ||
|
|
36
|
+
response.code === 0 ||
|
|
37
|
+
response.success ||
|
|
38
|
+
response.successed) {
|
|
39
|
+
const url = data && data.url;
|
|
36
40
|
setFileUrl(url);
|
|
37
41
|
props.onChange && props.onChange(url);
|
|
38
|
-
props.onDone && props.onDone(info.file,
|
|
42
|
+
props.onDone && props.onDone(info.file, data);
|
|
39
43
|
}
|
|
40
44
|
else {
|
|
41
45
|
Toast.error({
|
|
@@ -53,9 +53,13 @@ const ImgUpload = (props) => {
|
|
|
53
53
|
break;
|
|
54
54
|
case "done":
|
|
55
55
|
setLoading(false);
|
|
56
|
-
const response = info.file.response;
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
const response = info.file.response || {};
|
|
57
|
+
const data = response.data || response.model;
|
|
58
|
+
if (response.code === 200 ||
|
|
59
|
+
response.code === 0 ||
|
|
60
|
+
response.success ||
|
|
61
|
+
response.successed) {
|
|
62
|
+
const url = data && data.url;
|
|
59
63
|
setImageUrl(url);
|
|
60
64
|
// Form.item 值注入关键
|
|
61
65
|
props.onChange && props.onChange(url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecoding/components.antd",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.32",
|
|
4
4
|
"author": "cxc",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"react-quill": "^2.0.0"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "f05ee918e300259336caeec222f55010ab73958b"
|
|
48
48
|
}
|