assui 2.1.8 → 2.1.9

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.
@@ -9,6 +9,8 @@ export interface SingleImgUploadProps extends UploadProps {
9
9
  value?: string;
10
10
  wrapperClassName?: string;
11
11
  onDeleteUpload?: () => void;
12
+ /** 格式化接口返回数据 */
13
+ onFormatResData?: () => string;
12
14
  }
13
15
  declare const SingleImgUpload: {
14
16
  (props: SingleImgUploadProps): JSX.Element;
@@ -78,10 +78,11 @@ var SingleImgUpload = function SingleImgUpload(props) {
78
78
  value = props.value,
79
79
  onStart = props.onStart,
80
80
  onDeleteUpload = props.onDeleteUpload,
81
+ onFormatResData = props.onFormatResData,
81
82
  onSuccess = props.onSuccess,
82
83
  onError = props.onError,
83
84
  disabled = props.disabled,
84
- restProps = __rest(props, ["className", "wrapperClassName", "children", "value", "onStart", "onDeleteUpload", "onSuccess", "onError", "disabled"]);
85
+ restProps = __rest(props, ["className", "wrapperClassName", "children", "value", "onStart", "onDeleteUpload", "onFormatResData", "onSuccess", "onError", "disabled"]);
85
86
 
86
87
  var uploadInstanceRef = React.useRef();
87
88
  var fileRef = React.useRef();
@@ -127,7 +128,8 @@ var SingleImgUpload = function SingleImgUpload(props) {
127
128
  };
128
129
 
129
130
  var handleSuccess = function handleSuccess(res, file, xhr) {
130
- onSuccess && onSuccess(res, file, xhr);
131
+ var result = onFormatResData ? onFormatResData(res) : res;
132
+ onSuccess && onSuccess(result, file, xhr);
131
133
  setUploadStatus('done');
132
134
  };
133
135
 
@@ -9,6 +9,8 @@ export interface SingleImgUploadProps extends UploadProps {
9
9
  value?: string;
10
10
  wrapperClassName?: string;
11
11
  onDeleteUpload?: () => void;
12
+ /** 格式化接口返回数据 */
13
+ onFormatResData?: () => string;
12
14
  }
13
15
  declare const SingleImgUpload: {
14
16
  (props: SingleImgUploadProps): JSX.Element;
@@ -135,10 +135,11 @@ var SingleImgUpload = function SingleImgUpload(props) {
135
135
  value = props.value,
136
136
  onStart = props.onStart,
137
137
  onDeleteUpload = props.onDeleteUpload,
138
+ onFormatResData = props.onFormatResData,
138
139
  onSuccess = props.onSuccess,
139
140
  onError = props.onError,
140
141
  disabled = props.disabled,
141
- restProps = __rest(props, ["className", "wrapperClassName", "children", "value", "onStart", "onDeleteUpload", "onSuccess", "onError", "disabled"]);
142
+ restProps = __rest(props, ["className", "wrapperClassName", "children", "value", "onStart", "onDeleteUpload", "onFormatResData", "onSuccess", "onError", "disabled"]);
142
143
 
143
144
  var uploadInstanceRef = React.useRef();
144
145
  var fileRef = React.useRef();
@@ -184,7 +185,8 @@ var SingleImgUpload = function SingleImgUpload(props) {
184
185
  };
185
186
 
186
187
  var handleSuccess = function handleSuccess(res, file, xhr) {
187
- onSuccess && onSuccess(res, file, xhr);
188
+ var result = onFormatResData ? onFormatResData(res) : res;
189
+ onSuccess && onSuccess(result, file, xhr);
188
190
  setUploadStatus('done');
189
191
  };
190
192
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assui",
3
- "version": "2.1.8",
3
+ "version": "2.1.9",
4
4
  "description": "react ui library",
5
5
  "author": "jason <usochen@gmail.com>",
6
6
  "main": "./lib/index.js",
@@ -70,5 +70,5 @@
70
70
  "node": ">=10.0.0"
71
71
  },
72
72
  "license": "MIT",
73
- "gitHead": "835fd6a9638af8422e1f3dce765e902dd4b96261"
73
+ "gitHead": "933b30054fb25eb0e1d2af97e5a2cc5c0a8b564e"
74
74
  }