rc-upload
Advanced tools
Comparing version 1.11.0 to 1.12.0
# History | ||
---- | ||
### 1.12.0 2016-05-10 | ||
- add supportServerRender prop | ||
### 1.11.0 2016-05-03 | ||
@@ -5,0 +9,0 @@ |
@@ -39,3 +39,5 @@ 'use strict'; | ||
beforeUpload: _react.PropTypes.func, | ||
withCredentials: _react.PropTypes.bool | ||
onReady: _react.PropTypes.func, | ||
withCredentials: _react.PropTypes.bool, | ||
supportServerRender: _react.PropTypes.bool | ||
}, | ||
@@ -50,5 +52,7 @@ | ||
onProgress: empty, | ||
onReady: empty, | ||
onStart: empty, | ||
onError: empty, | ||
onSuccess: empty, | ||
supportServerRender: false, | ||
multiple: false, | ||
@@ -67,15 +71,24 @@ beforeUpload: null, | ||
componentDidMount: function componentDidMount() { | ||
/* eslint react/no-did-mount-set-state:0 */ | ||
this.setState({ | ||
Component: typeof FormData !== 'undefined' ? _AjaxUploader2['default'] : _IframeUploader2['default'] | ||
}); | ||
if (this.props.supportServerRender) { | ||
/* eslint react/no-did-mount-set-state:0 */ | ||
this.setState({ | ||
Component: this.getComponent() | ||
}, this.props.onReady); | ||
} | ||
}, | ||
getComponent: function getComponent() { | ||
return typeof FormData !== 'undefined' ? _AjaxUploader2['default'] : _IframeUploader2['default']; | ||
}, | ||
render: function render() { | ||
var Component = this.state.Component; | ||
if (this.props.supportServerRender) { | ||
var _Component = this.state.Component; | ||
if (Component) { | ||
return _react2['default'].createElement(Component, this.props); | ||
if (_Component) { | ||
return _react2['default'].createElement(_Component, this.props); | ||
} | ||
return null; | ||
} | ||
return null; | ||
var Component = this.getComponent(); | ||
return _react2['default'].createElement(Component, this.props); | ||
} | ||
@@ -82,0 +95,0 @@ }); |
{ | ||
"name": "rc-upload", | ||
"version": "1.11.0", | ||
"version": "1.12.0", | ||
"description": "upload ui component for react", | ||
@@ -29,3 +29,3 @@ "keywords": [ | ||
"config": { | ||
"port": 8000 | ||
"port": 8020 | ||
}, | ||
@@ -32,0 +32,0 @@ "scripts": { |
@@ -57,2 +57,4 @@ # rc-upload | ||
|name | string | file| file param post to server | | ||
|supportServerRender | boolean | false| whether to support server render | | ||
|onReady | function | | only call when supportServerRender is true, upload is rendered completely | | ||
|action| string | | from action url | | ||
@@ -59,0 +61,0 @@ |data| object/function(file) | | other data object to post or a function which returns a data object | |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20897
463
104