Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-upload

Package Overview
Dependencies
Maintainers
5
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-upload - npm Package Compare versions

Comparing version 3.0.4 to 3.1.0

22

es/AjaxUploader.js
import _extends from 'babel-runtime/helpers/extends';
import _defineProperty from 'babel-runtime/helpers/defineProperty';
import _objectWithoutProperties from 'babel-runtime/helpers/objectWithoutProperties';
import _slicedToArray from 'babel-runtime/helpers/slicedToArray';
import _classCallCheck from 'babel-runtime/helpers/classCallCheck';

@@ -148,3 +149,2 @@ import _createClass from 'babel-runtime/helpers/createClass';

var props = this.props;
var data = props.data;
var onStart = props.onStart,

@@ -159,9 +159,17 @@ onProgress = props.onProgress,

new Promise(function (resolve) {
var action = props.action;
var data = props.data,
action = props.action;
if (typeof action === 'function') {
return resolve(action(file));
action = action(file);
}
resolve(action);
}).then(function (action) {
if (typeof data === 'function') {
data = data(file);
}
resolve(Promise.all([action, data]));
}).then(function (_ref2) {
var _ref3 = _slicedToArray(_ref2, 2),
action = _ref3[0],
data = _ref3[1];
var uid = file.uid;

@@ -175,6 +183,2 @@

transform.then(function (transformedFile) {
if (typeof data === 'function') {
data = data(file);
}
var requestOption = {

@@ -181,0 +185,0 @@ action: action,

@@ -32,7 +32,2 @@ import _extends from 'babel-runtime/helpers/extends';

_createClass(Upload, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.props.onReady();
}
}, {
key: 'abort',

@@ -59,3 +54,2 @@ value: function abort(file) {

multipart: false,
onReady: empty,
onStart: empty,

@@ -62,0 +56,0 @@ onError: empty,

# History
----
### 3.1.0
- `data` could return Promise.
### 3.0.0

@@ -5,0 +9,0 @@

@@ -19,2 +19,6 @@ 'use strict';

var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

@@ -195,3 +199,2 @@

var props = this.props;
var data = props.data;
var onStart = props.onStart,

@@ -206,9 +209,17 @@ onProgress = props.onProgress,

new Promise(function (resolve) {
var action = props.action;
var data = props.data,
action = props.action;
if (typeof action === 'function') {
return resolve(action(file));
action = action(file);
}
resolve(action);
}).then(function (action) {
if (typeof data === 'function') {
data = data(file);
}
resolve(Promise.all([action, data]));
}).then(function (_ref2) {
var _ref3 = (0, _slicedToArray3['default'])(_ref2, 2),
action = _ref3[0],
data = _ref3[1];
var uid = file.uid;

@@ -222,6 +233,2 @@

transform.then(function (transformedFile) {
if (typeof data === 'function') {
data = data(file);
}
var requestOption = {

@@ -228,0 +235,0 @@ action: action,

@@ -60,7 +60,2 @@ 'use strict';

(0, _createClass3['default'])(Upload, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.props.onReady();
}
}, {
key: 'abort',

@@ -86,3 +81,2 @@ value: function abort(file) {

multipart: false,
onReady: empty,
onStart: empty,

@@ -89,0 +83,0 @@ onError: empty,

{
"name": "rc-upload",
"version": "3.0.4",
"version": "3.1.0",
"description": "upload ui component for react",

@@ -5,0 +5,0 @@ "keywords": [

@@ -61,7 +61,6 @@ # rc-upload

|component | "div"|"span" | "span"| wrap component name |
|onReady | function | | only call when supportServerRender is true, upload is rendered completely |
|action| string | function(file): string | Promise<string> | | form action url |
|method | string | post | request method |
|directory| boolean | false | support upload whole directory |
|data| object/function(file) | | other data object to post or a function which returns a data object |
|data| object/function(file) | | other data object to post or a function which returns a data object(a promise object which resolve a data object) |
|headers| object | {} | http headers to post, available in modern browsers |

@@ -68,0 +67,0 @@ |accept | string | | input accept attribute |

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc