|
@ -1,6 +1,7 @@ |
|
|
import * as React from 'react'; |
|
|
import * as React from 'react'; |
|
|
import RcUpload from 'rc-upload'; |
|
|
import RcUpload from 'rc-upload'; |
|
|
import classNames from 'classnames'; |
|
|
import classNames from 'classnames'; |
|
|
|
|
|
import uniqBy from 'lodash.uniqby'; |
|
|
import LocaleReceiver from '../locale-provider/LocaleReceiver'; |
|
|
import LocaleReceiver from '../locale-provider/LocaleReceiver'; |
|
|
import defaultLocale from '../locale-provider/default'; |
|
|
import defaultLocale from '../locale-provider/default'; |
|
|
import Dragger from './Dragger'; |
|
|
import Dragger from './Dragger'; |
|
@ -153,8 +154,8 @@ export default class Upload extends React.Component<UploadProps, UploadState> { |
|
|
this.handleRemove(file); |
|
|
this.handleRemove(file); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
onChange = (info: UploadChangeParam, updateState = true) => { |
|
|
onChange = (info: UploadChangeParam) => { |
|
|
if (!('fileList' in this.props) && updateState) { |
|
|
if (!('fileList' in this.props)) { |
|
|
this.setState({ fileList: info.fileList }); |
|
|
this.setState({ fileList: info.fileList }); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -186,8 +187,8 @@ export default class Upload extends React.Component<UploadProps, UploadState> { |
|
|
if (result === false) { |
|
|
if (result === false) { |
|
|
this.onChange({ |
|
|
this.onChange({ |
|
|
file, |
|
|
file, |
|
|
fileList, |
|
|
fileList: uniqBy(fileList.concat(this.state.fileList), (item: any) => item.uid), |
|
|
}, false); |
|
|
}); |
|
|
return false; |
|
|
return false; |
|
|
} else if (result && (result as PromiseLike<any>).then) { |
|
|
} else if (result && (result as PromiseLike<any>).then) { |
|
|
return result; |
|
|
return result; |
|
|