forked from p96170835/amis
commit
f3bbb8e06c
|
@ -43,6 +43,7 @@ export interface FileProps extends FormControlProps {
|
||||||
[propName:string]: string;
|
[propName:string]: string;
|
||||||
};
|
};
|
||||||
asBase64?: boolean;
|
asBase64?: boolean;
|
||||||
|
resetValue?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export interface FileX extends File {
|
export interface FileX extends File {
|
||||||
|
@ -382,7 +383,8 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
||||||
joinValues,
|
joinValues,
|
||||||
extractValue,
|
extractValue,
|
||||||
valueField,
|
valueField,
|
||||||
delimiter
|
delimiter,
|
||||||
|
resetValue
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
const files = this.state.files.filter(file => file.state == 'uploaded' || file.state == 'init');
|
const files = this.state.files.filter(file => file.state == 'uploaded' || file.state == 'init');
|
||||||
|
@ -394,12 +396,10 @@ export default class FileControl extends React.Component<FileProps, FileState> {
|
||||||
} else if (extractValue) {
|
} else if (extractValue) {
|
||||||
value = Array.isArray(value) ? value.map((item: any) => item[valueField || 'value']) : value[valueField || 'value'];
|
value = Array.isArray(value) ? value.map((item: any) => item[valueField || 'value']) : value[valueField || 'value'];
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
value = typeof resetValue === 'undefined' ? '' : resetValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (joinValues && value) {
|
|
||||||
// value = Array.isArray(value) ? value.map((item:any) => item[valueField || 'value']).join(delimiter || ',') : value[valueField || 'value']
|
|
||||||
// }
|
|
||||||
|
|
||||||
onChange(value);
|
onChange(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue