|
|
|
@ -72,6 +72,7 @@ export default class Upload extends React.Component {
|
|
|
|
|
showUploadList: true,
|
|
|
|
|
listType: 'text', // or pictrue
|
|
|
|
|
className: '',
|
|
|
|
|
disabled: false,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
constructor(props) {
|
|
|
|
@ -197,6 +198,7 @@ export default class Upload extends React.Component {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
handleManualRemove = (file) => {
|
|
|
|
|
this.refs.upload.abort(file);
|
|
|
|
|
/*eslint-disable */
|
|
|
|
|
file.status = 'removed';
|
|
|
|
|
/*eslint-enable */
|
|
|
|
@ -253,18 +255,21 @@ export default class Upload extends React.Component {
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
if (type === 'drag') {
|
|
|
|
|
let dragUploadingClass = this.state.fileList.some(file => file.status === 'uploading')
|
|
|
|
|
? `${prefixCls}-drag-uploading` : '';
|
|
|
|
|
let draggingClass = this.state.dragState === 'dragover'
|
|
|
|
|
? `${prefixCls}-drag-hover` : '';
|
|
|
|
|
const dragCls = classNames({
|
|
|
|
|
[prefixCls]: true,
|
|
|
|
|
[`${prefixCls}-drag`]: true,
|
|
|
|
|
[`${prefixCls}-drag-uploading`]: this.state.fileList.some(file => file.status === 'uploading'),
|
|
|
|
|
[`${prefixCls}-drag-hover`]: this.state.dragState === 'dragover',
|
|
|
|
|
[`${prefixCls}-disabled`]: this.props.disabled,
|
|
|
|
|
});
|
|
|
|
|
return (
|
|
|
|
|
<span className={this.props.className}>
|
|
|
|
|
<div className={`${prefixCls} ${prefixCls}-drag ${dragUploadingClass} ${draggingClass}`}
|
|
|
|
|
<div className={dragCls}
|
|
|
|
|
onDrop={this.onFileDrop}
|
|
|
|
|
onDragOver={this.onFileDrop}
|
|
|
|
|
onDragLeave={this.onFileDrop}
|
|
|
|
|
>
|
|
|
|
|
<RcUpload {...props}>
|
|
|
|
|
<RcUpload {...props} ref="upload">
|
|
|
|
|
<div className={`${prefixCls}-drag-container`}>
|
|
|
|
|
{this.props.children}
|
|
|
|
|
</div>
|
|
|
|
@ -279,10 +284,11 @@ export default class Upload extends React.Component {
|
|
|
|
|
[prefixCls]: true,
|
|
|
|
|
[`${prefixCls}-select`]: true,
|
|
|
|
|
[`${prefixCls}-select-${this.props.listType}`]: true,
|
|
|
|
|
[`${prefixCls}-disabled`]: this.props.disabled,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const uploadButton = this.props.children
|
|
|
|
|
? <div className={uploadButtonCls}><RcUpload {...props} /></div>
|
|
|
|
|
? <div className={uploadButtonCls}><RcUpload {...props} ref="upload" /></div>
|
|
|
|
|
: null;
|
|
|
|
|
|
|
|
|
|
if (this.props.listType === 'picture-card') {
|
|
|
|
|