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

View File

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