补一下file

This commit is contained in:
rickcole 2020-08-10 23:49:39 +08:00
parent 989f9478ea
commit b8b3f1b283
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 {translate: __} = this.props;
this._send(file, this.props.reciever as string, {}, onProgress)
.then((ret: Payload) => {
if (ret.status) {