Skip to content

Commit

Permalink
ver. 1.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
光弘 committed May 25, 2016
1 parent 9f89ef9 commit cb66c79
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 14 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

---

## 1.5.3

* `CHANGED` remove Progress.isSupport
* `NEW` add server render support

## 1.5.2

* `CHANGED` add className for download & preview button
Expand Down
1 change: 1 addition & 0 deletions demo/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class Demo1 extends React.Component {
ref="uploader"
multiple={false}
isOnlyImg={false}
progressInterval={100}
queueCapcity={2}
onqueueerror={function(err) {console.log(err); console.log(me.refs.uploader.getCore().getTotal())}}
fileList={this.state.fileList}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uxcore-uploader",
"version": "1.5.2",
"version": "1.5.3",
"description": "uxcore-uploader component for react",
"main": "build/index.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions src/FileItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class FileItem extends React.Component {

render() {
let me = this;
let {locale} = me.props;
let {locale, interval} = me.props;
if (this.props.mode === 'icon') {
return <div className={"kuma-upload-fileitem status-" + this.state.status}>
<a className="kuma-upload-action action-remove" onClick={this.onCancel.bind(this)} title={i18n[locale]['remove']}>
Expand All @@ -79,7 +79,7 @@ class FileItem extends React.Component {
{this.state.status === 'queued' ? <a className="kuma-upload-action action-upload" onClick={this.onPending.bind(this)} title={i18n[locale]['upload']}>
<i className="kuma-icon kuma-icon-triangle-right" />
</a> : null}
{this.state.status === 'progress' || this.state.status === 'pending' ? <Progress percentage={this.state.percentage} /> : null}
{this.state.status === 'progress' || this.state.status === 'pending' ? <Progress interval={interval} percentage={this.state.percentage} /> : null}
</div>
{this.state.status === 'error' ? <a className="kuma-upload-status status-error" title={i18n[locale]['upload_failed']}><i className="kuma-icon kuma-icon-caution" /></a> : null}
{this.state.status === 'success' ? <a className="kuma-upload-status status-success"><i className="kuma-icon kuma-icon-choose" /></a> : null}
Expand Down Expand Up @@ -123,7 +123,7 @@ class FileItem extends React.Component {
</label>
<label className="field-status">
{this.state.status === 'error' ? <a className="kuma-upload-status status-error">{i18n[locale]['upload_failed']}</a> : null}
{this.state.status !== 'error' && this.state.status !== 'success' ? <Progress /> : null}
{this.state.status !== 'error' && this.state.status !== 'success' ? <Progress interval={interval} /> : null}
{(this.state.status === 'success' || this.state.status === 'error') ? <a className="kuma-upload-action close-action" onClick={this.onCancel.bind(this)}><i className="kuma-icon kuma-icon-close"></i></a> : null}
{this.state.status === 'success' && previewUrl ? <a className="kuma-upload-action" target="_blank" href={previewUrl}>{i18n[locale]['preview']}</a> : null}
{this.state.status === 'success' && downloadUrl ? <a className="kuma-upload-action" target="_blank" href={downloadUrl}>{i18n[locale]['download']}</a> : null}
Expand Down Expand Up @@ -155,7 +155,7 @@ class FileItem extends React.Component {
<i className="kuma-icon kuma-icon-close" />
</a>
</label>
<Progress percentage={this.state.percentage} mode="bar"/>
<Progress interval={interval} percentage={this.state.percentage} mode="bar"/>
</div>;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/FileList.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class FileList extends React.Component {
let arr = [];
this.state.items.forEach((file) => {
if (file.status !== Status.SUCCESS && file.status !== Status.CANCELLED) {
arr.push(<FileItem locale={this.props.locale} key={file.id} file={file} mode={this.props.mode} isOnlyImg={this.props.isOnlyImg} />);
arr.push(<FileItem locale={this.props.locale} key={file.id} file={file} mode={this.props.mode} isOnlyImg={this.props.isOnlyImg} interval={this.props.interval} />);
}
});
return arr;
Expand Down
10 changes: 5 additions & 5 deletions src/Progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class Progress extends React.Component {
if (percentage === 95) {
clearInterval(me.t);
}
}, 100);
}, me.props.interval);
}

componentWillUnmount() {
Expand All @@ -45,13 +45,13 @@ class Progress extends React.Component {
}
}

Progress.isSupport = util.TRANSFORM_PROPERTY !== false;

Progress.propTypes = {
percentage: React.PropTypes.number
percentage: React.PropTypes.number,
interval: React.PropTypes.number
};
Progress.defaultProps = {
percentage: 0
percentage: 0,
interval: 100
};

module.exports = Progress;
2 changes: 1 addition & 1 deletion src/Uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class Uploader extends React.Component {
return <div className={"kuma-uploader " + (this.props.className || '')}>
<Picker core={this.core}>{children}</Picker>
{this.props.tips}
{(this.state.total > 0 || this.state.fileList.length > 0) ? (<FileList locale={this.props.locale} core={this.core} isOnlyImg={this.props.isOnlyImg} mode="nw" fileList={me.state.fileList} removeFileFromList={me.handleRemoveFile.bind(me)} />) : null}
{(this.state.total > 0 || this.state.fileList.length > 0) ? (<FileList locale={this.props.locale} core={this.core} isOnlyImg={this.props.isOnlyImg} mode="nw" fileList={me.state.fileList} removeFileFromList={me.handleRemoveFile.bind(me)} interval={this.props.progressInterval}/>) : null}
</div>;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ module.exports = {
simpleDeepEqual: (a, b) => {
return JSON.stringify(a) === JSON.stringify(b)
},
TRANSFORM_PROPERTY: (() => {
TRANSFORM_PROPERTY: () => {
const style = document.createElement("div").style;
const properties = ["transform", "WebkitTransform", "MozTransform", "msTransform"];
for (let i = 0, l = properties.length; i < l; i++) {
Expand All @@ -116,5 +116,5 @@ module.exports = {
}
}
return false;
})()
}
}

0 comments on commit cb66c79

Please sign in to comment.