@ecoding/components.antd 0.3.60 → 0.3.61
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/lib/core/multiple-img-upload/index.js +11 -35
- package/lib/core/multiple-single-img-upload/index.js +1 -1
- package/lib/core/multiple-upload/index.d.ts +2 -2
- package/lib/core/multiple-upload/index.js +4 -4
- package/lib/core/single-file-upload/index.js +1 -1
- package/lib/core/single-img-upload/index.js +1 -1
- package/package.json +2 -2
|
@@ -11,8 +11,6 @@ import React, { useState, useCallback, useMemo } from 'react';
|
|
|
11
11
|
import { Upload, Image as Img, Alert, Flex, message } from 'antd';
|
|
12
12
|
import { PlusOutlined } from '@ant-design/icons';
|
|
13
13
|
import { buildURL } from "@ecoding/helper.url";
|
|
14
|
-
import Toast from "../../core/toast";
|
|
15
|
-
import Loading from "../../core/loading";
|
|
16
14
|
import { DndContext, PointerSensor, useSensor } from '@dnd-kit/core';
|
|
17
15
|
import { arrayMove, SortableContext, useSortable, horizontalListSortingStrategy, } from '@dnd-kit/sortable';
|
|
18
16
|
import { CSS } from '@dnd-kit/utilities';
|
|
@@ -63,39 +61,17 @@ const MultipleImgUpload = (props) => {
|
|
|
63
61
|
});
|
|
64
62
|
onChange && (onChange === null || onChange === void 0 ? void 0 : onChange(!isEmpty ? urls : undefined));
|
|
65
63
|
};
|
|
66
|
-
const handleChange = (
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
break;
|
|
71
|
-
case 'done': {
|
|
72
|
-
Loading.hide();
|
|
73
|
-
const response = info.file.response;
|
|
74
|
-
if (response && response.code === 200) {
|
|
75
|
-
const data = response.data || {};
|
|
76
|
-
const temp = imgList.concat([Object.assign({}, data)]);
|
|
77
|
-
updateItems(temp);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
Toast.error({
|
|
81
|
-
mask: true,
|
|
82
|
-
title: response.message || '服务出错,图片上传失败'
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
break;
|
|
64
|
+
const handleChange = ({ fileList }) => {
|
|
65
|
+
fileList && fileList.forEach((item) => {
|
|
66
|
+
if (item.status == "done" && item.response.code == 200 && item.response.data) {
|
|
67
|
+
item.url = item.response.data.url;
|
|
86
68
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
Loading.hide();
|
|
94
|
-
break;
|
|
95
|
-
}
|
|
96
|
-
default:
|
|
97
|
-
break;
|
|
98
|
-
}
|
|
69
|
+
});
|
|
70
|
+
updateItems(fileList);
|
|
71
|
+
// if (len) {
|
|
72
|
+
// return;
|
|
73
|
+
// }
|
|
74
|
+
// updateItems(fileList)
|
|
99
75
|
};
|
|
100
76
|
const handleRemove = (file) => {
|
|
101
77
|
const lefts = imgList.filter(item => item.uid !== file.uid);
|
|
@@ -221,7 +197,7 @@ MultipleImgUpload.defaultProps = {
|
|
|
221
197
|
action: "/api/upload/img",
|
|
222
198
|
name: "file",
|
|
223
199
|
gif: false,
|
|
224
|
-
buttonText: '
|
|
200
|
+
buttonText: 'Upload',
|
|
225
201
|
data: {},
|
|
226
202
|
actionParams: {},
|
|
227
203
|
opts: {
|
|
@@ -26,5 +26,5 @@ interface IProps {
|
|
|
26
26
|
openFileDialogOnClick?: boolean;
|
|
27
27
|
style?: React.CSSProperties;
|
|
28
28
|
}
|
|
29
|
-
declare const
|
|
30
|
-
export default
|
|
29
|
+
declare const MultipleUpload: React.FC<IProps>;
|
|
30
|
+
export default MultipleUpload;
|
|
@@ -37,7 +37,7 @@ const InfosRender = ({ infos, setInfos, onChange }) => {
|
|
|
37
37
|
}
|
|
38
38
|
return React.createElement(Empty, { imageStyle: { height: 30 }, image: Empty.PRESENTED_IMAGE_SIMPLE });
|
|
39
39
|
};
|
|
40
|
-
const
|
|
40
|
+
const MultipleUpload = (props) => {
|
|
41
41
|
const [infos, setInfos] = useState([]);
|
|
42
42
|
const [open, setOpen] = useState(undefined);
|
|
43
43
|
const timeout = useRef();
|
|
@@ -128,7 +128,7 @@ const SingleFileUpload = (props) => {
|
|
|
128
128
|
React.createElement(Popover, { destroyTooltipOnHide: true, open: open, placement: "right", trigger: "hover", title: "Uploaded", content: React.createElement(InfosRender, { onChange: props.onChange, infos: infos, setInfos: setInfos }) },
|
|
129
129
|
React.createElement(Button, { icon: React.createElement(EllipsisOutlined, null) }))));
|
|
130
130
|
};
|
|
131
|
-
|
|
131
|
+
MultipleUpload.defaultProps = {
|
|
132
132
|
name: 'file',
|
|
133
133
|
openFileDialogOnClick: true,
|
|
134
134
|
icon: true,
|
|
@@ -136,8 +136,8 @@ SingleFileUpload.defaultProps = {
|
|
|
136
136
|
extraData: {},
|
|
137
137
|
maxCount: 10,
|
|
138
138
|
headers: undefined,
|
|
139
|
-
buttonText: '
|
|
139
|
+
buttonText: 'Upload',
|
|
140
140
|
type: 'jpg, jpeg, png, gif, bmp, wbmp, webp, tif, woff, woff2, ttf, otf, txt, psd, svg, js, jsx, json, css, less, html, htm, xml, pdf, zip, gz, tgz, gzip, mp3, mp4, avi, xlsx, xls, doc, docx, ppt, pptx, rar, 7z',
|
|
141
141
|
style: {}
|
|
142
142
|
};
|
|
143
|
-
export default
|
|
143
|
+
export default MultipleUpload;
|
|
@@ -101,7 +101,7 @@ SingleFileUpload.defaultProps = {
|
|
|
101
101
|
icon: true,
|
|
102
102
|
data: {},
|
|
103
103
|
actionParams: {},
|
|
104
|
-
buttonText: "
|
|
104
|
+
buttonText: "Upload",
|
|
105
105
|
type: "jpg, jpeg, png, gif, bmp, wbmp, webp, tif, woff, woff2, ttf, otf, txt, psd, svg, js, jsx, json, css, less, html, htm, xml, pdf, zip, gz, tgz, gzip, mp3, mp4, avi, xlsx, xls, doc, docx, ppt, pptx, rar, 7z",
|
|
106
106
|
style: {}
|
|
107
107
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ecoding/components.antd",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.61",
|
|
4
4
|
"author": "cxc",
|
|
5
5
|
"homepage": "",
|
|
6
6
|
"license": "MIT",
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"antd": "5.27.0",
|
|
48
48
|
"axios": "^1.1.2"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "40631c611e4f76eb3f693ba01640b53fe97ba494"
|
|
51
51
|
}
|