|
|
|
@ -7,6 +7,7 @@ import defaultLocale from '../locale-provider/default';
|
|
|
|
|
import Dragger from './Dragger';
|
|
|
|
|
import UploadList from './UploadList';
|
|
|
|
|
import {
|
|
|
|
|
RcFile,
|
|
|
|
|
UploadProps,
|
|
|
|
|
UploadState,
|
|
|
|
|
UploadFile,
|
|
|
|
@ -55,7 +56,7 @@ export default class Upload extends React.Component<UploadProps, UploadState> {
|
|
|
|
|
this.clearProgressTimer();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onStart = (file: UploadFile) => {
|
|
|
|
|
onStart = (file: RcFile) => {
|
|
|
|
|
let targetItem;
|
|
|
|
|
let nextFileList = this.state.fileList.concat();
|
|
|
|
|
targetItem = fileToObject(file);
|
|
|
|
@ -187,15 +188,15 @@ export default class Upload extends React.Component<UploadProps, UploadState> {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
beforeUpload = (file: UploadFile, fileList: UploadFile[]) => {
|
|
|
|
|
beforeUpload = (file: RcFile, fileList: RcFile[]) => {
|
|
|
|
|
if (!this.props.beforeUpload) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
const result = this.props.beforeUpload(file, fileList);
|
|
|
|
|
if (result === false) {
|
|
|
|
|
this.onChange({
|
|
|
|
|
file,
|
|
|
|
|
fileList: uniqBy(fileList.concat(this.state.fileList), (item: any) => item.uid),
|
|
|
|
|
file: fileToObject(file),
|
|
|
|
|
fileList: uniqBy(fileList.map(fileToObject).concat(this.state.fileList), (item: UploadFile) => item.uid),
|
|
|
|
|
});
|
|
|
|
|
return false;
|
|
|
|
|
} else if (result && (result as PromiseLike<any>).then) {
|
|
|
|
|