@ecoding/components.antd 0.2.18 → 0.2.19

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.
@@ -7,7 +7,7 @@ interface IProps {
7
7
  name?: string;
8
8
  value?: any;
9
9
  uploadRef?: any;
10
- onChange?: (file: UploadFile) => void;
10
+ onChange?: (url: string) => void;
11
11
  onDone?: (file: UploadFile, res: any) => void;
12
12
  onRemove?: (file: UploadFile) => void;
13
13
  onError?: (file: UploadFile) => void;
@@ -21,15 +21,16 @@ const SingleFileUpload = (props) => {
21
21
  return /^http|^\/\//i.test(props.action) ? buildURL(props.action, urlParams) : buildURL(`${r.domain}${props.action}`, urlParams);
22
22
  }, [urlParams]);
23
23
  const handleChange = (info) => {
24
- var _a, _b;
25
- props.onChange && props.onChange(info.file);
24
+ // props.onChange && props.onChange(info.file);
26
25
  switch (info.file.status) {
27
26
  case "uploading":
28
27
  break;
29
28
  case "done":
30
29
  const response = info.file.response;
31
30
  if ((response && response.code === 200) || response.success) {
32
- setFileUrl(((_b = (_a = info.file.response) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.url) || "");
31
+ const url = response.data && response.data.url;
32
+ setFileUrl(url);
33
+ props.onChange && props.onChange(url);
33
34
  props.onDone && props.onDone(info.file, info.file.response.data);
34
35
  }
35
36
  else {
@@ -73,7 +74,11 @@ const SingleFileUpload = (props) => {
73
74
  }
74
75
  }, [props.value]);
75
76
  return (React.createElement(Space.Compact, { block: true },
76
- React.createElement(Input, { value: fileUrl, onChange: (e) => setFileUrl(e.target.value.trim()) }),
77
+ React.createElement(Input, { value: fileUrl, onChange: (e) => {
78
+ const v = e.target.value.trim();
79
+ // setFileUrl(v);
80
+ props.onChange && props.onChange(v);
81
+ } }),
77
82
  React.createElement(Upload, { ref: props.uploadRef, withCredentials: true, openFileDialogOnClick: props.openFileDialogOnClick, beforeUpload: beforeUpload, name: props.name, disabled: props.disabled, action: action, onChange: handleChange, showUploadList: false, onRemove: (e) => {
78
83
  console.log(e);
79
84
  props.onRemove && props.onRemove(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecoding/components.antd",
3
- "version": "0.2.18",
3
+ "version": "0.2.19",
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": "65c39fd48fe8394b7a8f294e9d2f5108590806ee"
47
+ "gitHead": "645a375c4e920de687d0e6a9909959b2b4cecdab"
48
48
  }