Merge pull request #839 from RickCole21/master

补一下file
This commit is contained in:
RickCole 2020-08-10 23:54:58 +08:00 committed by GitHub
commit 23fc3cbdbb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 14 deletions

View File

@ -400,7 +400,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
return;
}
const __ = this.props.translate;
const {translate: __, multiple, autoFill, onBulkChange} = this.props;
const file = find(
this.state.files,
item => item.state === 'pending'
@ -441,7 +441,16 @@ export default class FileControl extends React.Component<FileProps, FileState> {
error: error ? error : null,
files: files
},
this.tick
() => {
const sendTo =
!multiple &&
autoFill &&
!isEmpty(autoFill) &&
dataMapping(autoFill, obj || {});
sendTo && onBulkChange(sendTo);
this.tick();
}
);
},
progress => {
@ -498,10 +507,7 @@ export default class FileControl extends React.Component<FileProps, FileState> {
asBase64,
asBlob,
data,
translate: __,
multiple,
autoFill,
onBulkChange
translate: __
} = this.props;
if (asBase64) {
@ -563,13 +569,6 @@ export default class FileControl extends React.Component<FileProps, FileState> {
onProgress(1);
const value = (ret.data as any).value || ret.data;
const sendTo =
!multiple &&
autoFill &&
!isEmpty(autoFill) &&
dataMapping(autoFill, ret.data);
sendTo && onBulkChange(sendTo);
cb(null, file, {
...(isPlainObject(ret.data) ? ret.data : null),
value: value,

View File

@ -774,7 +774,7 @@ export default class ImageControl extends React.Component<
cb: (error: null | string, file: Blob, obj?: FileValue) => void,
onProgress: (progress: number) => void
) {
const {translate: __, multiple, autoFill, onBulkChange} = this.props;
const __ = this.props.translate;
this._send(file, this.props.reciever as string, {}, onProgress)
.then((ret: Payload) => {
if (ret.status) {