rsuite 5.15.0 → 5.15.1
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/CHANGELOG.md +6 -0
- package/cjs/Uploader/Uploader.d.ts +2 -0
- package/cjs/Uploader/Uploader.js +6 -2
- package/cjs/utils/ajaxUpload.d.ts +1 -0
- package/cjs/utils/ajaxUpload.js +3 -1
- package/dist/rsuite.js +2 -2
- package/dist/rsuite.min.js +1 -1
- package/dist/rsuite.min.js.map +1 -1
- package/esm/Uploader/Uploader.d.ts +2 -0
- package/esm/Uploader/Uploader.js +6 -2
- package/esm/utils/ajaxUpload.d.ts +1 -0
- package/esm/utils/ajaxUpload.js +3 -1
- package/package.json +1 -1
|
@@ -71,6 +71,8 @@ export interface UploaderProps extends WithAsProps {
|
|
|
71
71
|
draggable?: boolean;
|
|
72
72
|
/** Custom locale */
|
|
73
73
|
locale?: UploaderLocale;
|
|
74
|
+
/** The http method of upload request */
|
|
75
|
+
method?: string;
|
|
74
76
|
/** Allow the queue to be updated. After you select a file, update the checksum function before the upload file queue, and return false to not update */
|
|
75
77
|
shouldQueueUpdate?: (fileList: FileType[], newFile: FileType[] | FileType) => boolean | Promise<boolean>;
|
|
76
78
|
/** Allow uploading of files. Check function before file upload, return false without uploading */
|
package/esm/Uploader/Uploader.js
CHANGED
|
@@ -123,6 +123,8 @@ var Uploader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
123
123
|
removable = _props$removable === void 0 ? true : _props$removable,
|
|
124
124
|
disabledFileItem = props.disabledFileItem,
|
|
125
125
|
maxPreviewFileSize = props.maxPreviewFileSize,
|
|
126
|
+
_props$method = props.method,
|
|
127
|
+
method = _props$method === void 0 ? 'POST' : _props$method,
|
|
126
128
|
_props$autoUpload = props.autoUpload,
|
|
127
129
|
autoUpload = _props$autoUpload === void 0 ? true : _props$autoUpload,
|
|
128
130
|
action = props.action,
|
|
@@ -146,7 +148,7 @@ var Uploader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
146
148
|
onError = props.onError,
|
|
147
149
|
onProgress = props.onProgress,
|
|
148
150
|
onReupload = props.onReupload,
|
|
149
|
-
rest = _objectWithoutPropertiesLoose(props, ["as", "classPrefix", "className", "listType", "defaultFileList", "fileList", "fileListVisible", "locale", "style", "draggable", "name", "multiple", "disabled", "readOnly", "plaintext", "accept", "children", "toggleAs", "removable", "disabledFileItem", "maxPreviewFileSize", "autoUpload", "action", "headers", "withCredentials", "disableMultipart", "timeout", "data", "onRemove", "onUpload", "shouldUpload", "shouldQueueUpdate", "renderFileInfo", "renderThumbnail", "onPreview", "onChange", "onSuccess", "onError", "onProgress", "onReupload"]);
|
|
151
|
+
rest = _objectWithoutPropertiesLoose(props, ["as", "classPrefix", "className", "listType", "defaultFileList", "fileList", "fileListVisible", "locale", "style", "draggable", "name", "multiple", "disabled", "readOnly", "plaintext", "accept", "children", "toggleAs", "removable", "disabledFileItem", "maxPreviewFileSize", "method", "autoUpload", "action", "headers", "withCredentials", "disableMultipart", "timeout", "data", "onRemove", "onUpload", "shouldUpload", "shouldQueueUpdate", "renderFileInfo", "renderThumbnail", "onPreview", "onChange", "onSuccess", "onError", "onProgress", "onReupload"]);
|
|
150
152
|
|
|
151
153
|
var _useClassNames = useClassNames(classPrefix),
|
|
152
154
|
merge = _useClassNames.merge,
|
|
@@ -253,6 +255,7 @@ var Uploader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
253
255
|
timeout: timeout,
|
|
254
256
|
headers: headers,
|
|
255
257
|
data: data,
|
|
258
|
+
method: method,
|
|
256
259
|
withCredentials: withCredentials,
|
|
257
260
|
disableMultipart: disableMultipart,
|
|
258
261
|
file: file.blobFile,
|
|
@@ -273,7 +276,7 @@ var Uploader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
273
276
|
}
|
|
274
277
|
|
|
275
278
|
onUpload === null || onUpload === void 0 ? void 0 : onUpload(file, uploadData, xhr);
|
|
276
|
-
}, [
|
|
279
|
+
}, [name, timeout, headers, data, method, withCredentials, disableMultipart, action, handleAjaxUploadError, handleAjaxUploadSuccess, handleAjaxUploadProgress, updateFileStatus, onUpload]);
|
|
277
280
|
var handleAjaxUpload = useCallback(function () {
|
|
278
281
|
fileList.current.forEach(function (file) {
|
|
279
282
|
var checkState = shouldUpload === null || shouldUpload === void 0 ? void 0 : shouldUpload(file);
|
|
@@ -466,6 +469,7 @@ Uploader.propTypes = {
|
|
|
466
469
|
onProgress: PropTypes.func,
|
|
467
470
|
onRemove: PropTypes.func,
|
|
468
471
|
maxPreviewFileSize: PropTypes.number,
|
|
472
|
+
method: PropTypes.string,
|
|
469
473
|
style: PropTypes.object,
|
|
470
474
|
renderFileInfo: PropTypes.func,
|
|
471
475
|
renderThumbnail: PropTypes.func,
|
|
@@ -11,6 +11,7 @@ interface Options {
|
|
|
11
11
|
headers?: any;
|
|
12
12
|
file: File;
|
|
13
13
|
url: string;
|
|
14
|
+
method?: string;
|
|
14
15
|
onError: (status: ErrorStatus, event: ProgressEvent, xhr: XMLHttpRequest) => void;
|
|
15
16
|
onSuccess: (response: any, event: ProgressEvent, xhr: XMLHttpRequest) => void;
|
|
16
17
|
onProgress: (percent: number, event: ProgressEvent, xhr: XMLHttpRequest) => void;
|
package/esm/utils/ajaxUpload.js
CHANGED
|
@@ -19,6 +19,8 @@ export default function ajaxUpload(options) {
|
|
|
19
19
|
headers = _options$headers === void 0 ? {} : _options$headers,
|
|
20
20
|
_options$data = options.data,
|
|
21
21
|
data = _options$data === void 0 ? {} : _options$data,
|
|
22
|
+
_options$method = options.method,
|
|
23
|
+
method = _options$method === void 0 ? 'POST' : _options$method,
|
|
22
24
|
onError = options.onError,
|
|
23
25
|
onSuccess = options.onSuccess,
|
|
24
26
|
onProgress = options.onProgress,
|
|
@@ -28,7 +30,7 @@ export default function ajaxUpload(options) {
|
|
|
28
30
|
disableMultipart = options.disableMultipart;
|
|
29
31
|
var xhr = new XMLHttpRequest();
|
|
30
32
|
var sendableData;
|
|
31
|
-
xhr.open(
|
|
33
|
+
xhr.open(method, url, true);
|
|
32
34
|
|
|
33
35
|
if (!disableMultipart) {
|
|
34
36
|
sendableData = new FormData();
|