Upload.js
1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
import _createClass from "@babel/runtime/helpers/esm/createClass";
import _inherits from "@babel/runtime/helpers/esm/inherits";
import _createSuper from "@babel/runtime/helpers/esm/createSuper";
/* eslint react/prop-types:0 */
import React, { Component } from 'react';
import AjaxUpload from './AjaxUploader';
function empty() {}
var Upload = /*#__PURE__*/function (_Component) {
_inherits(Upload, _Component);
var _super = _createSuper(Upload);
function Upload() {
var _this;
_classCallCheck(this, Upload);
_this = _super.apply(this, arguments);
_this.saveUploader = function (node) {
_this.uploader = node;
};
return _this;
}
_createClass(Upload, [{
key: "abort",
value: function abort(file) {
this.uploader.abort(file);
}
}, {
key: "render",
value: function render() {
return React.createElement(AjaxUpload, Object.assign({}, this.props, {
ref: this.saveUploader
}));
}
}]);
return Upload;
}(Component);
Upload.defaultProps = {
component: 'span',
prefixCls: 'rc-upload',
data: {},
headers: {},
name: 'file',
multipart: false,
onStart: empty,
onError: empty,
onSuccess: empty,
multiple: false,
beforeUpload: null,
customRequest: null,
withCredentials: false,
openFileDialogOnClick: true
};
export default Upload;