Merge branch '0.8.0' of github.com:ant-design/ant-design into 0.8.0

This commit is contained in:
yiminghe
2015-08-21 14:54:56 +08:00
2 changed files with 35 additions and 16 deletions
+12 -10
View File
@@ -25,9 +25,9 @@ let AntUpload = React.createClass({
});
},
handleSuccess(ret, file) {
var matchWay = file.uid === '' ? 'byName' : 'byUid';
let matchWay = (!file.uid) ? 'byName' : 'byUid';
Message.success(file.name + '上传完成');
for (var i = 0; i < this.state.downloadList.length; i++) {
for (let i = 0; i < this.state.downloadList.length; i++) {
if (matchWay === 'byName') {
if (this.state.downloadList[i].filename === file.name) {
this.state.downloadList[i].status = 'done';
@@ -84,20 +84,22 @@ let AntUpload = React.createClass({
};
if (type === 'drag') {
return (
<Upload {...props}>
<div className={prefixCls + ' ' + prefixCls + '-drag'}>
<div className={prefixCls + ' ' + prefixCls + '-drag'}>
<Upload {...props}>
<div className={prefixCls + '-drag-container'}>
{this.props.children}
</div>
</div>
</Upload>
</Upload>
</div>
);
} else if (type === 'select') {
return (
<div className={prefixCls + ' ' + prefixCls + '-select'}>
<Upload {...props}>
{this.props.children}
</Upload>
<div>
<div className={prefixCls + ' ' + prefixCls + '-select'}>
<Upload {...props}>
{this.props.children}
</Upload>
</div>
<UploadList items={this.state.downloadList} />
</div>
);
+23 -6
View File
@@ -1,6 +1,21 @@
@upload-prefix-cls: ant-upload;
.@{upload-prefix-cls} {
> span {
display: block;
width: 100%;
height: 100%;
}
input[type=file] {
cursor: pointer;
}
&.@{upload-prefix-cls}-select {
display: inline-block;
}
&.@{upload-prefix-cls}-drag {
border: 1px dashed #d9d9d9;
transition: all 0.3s ease;
@@ -11,13 +26,15 @@
height: 100%;
position: relative;
.@{upload-prefix-cls}-drag-container {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
> span {
display: table;
}
.@{upload-prefix-cls}-drag-container {
display: table-cell;
vertical-align: middle;
}
&:hover {
border: 1px dashed #999;
}