|
|
@ -66,7 +66,7 @@ export default class UploadList extends React.Component<UploadListProps, any> {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render() {
|
|
|
|
render() {
|
|
|
|
const { prefixCls, items = [], listType, showPreviewIcon, showRemoveIcon } = this.props;
|
|
|
|
const { prefixCls, items = [], listType, showPreviewIcon, showRemoveIcon, locale } = this.props;
|
|
|
|
const list = items.map(file => {
|
|
|
|
const list = items.map(file => {
|
|
|
|
let progress;
|
|
|
|
let progress;
|
|
|
|
let icon = <Icon type="paper-clip" />;
|
|
|
|
let icon = <Icon type="paper-clip" />;
|
|
|
@ -74,7 +74,7 @@ export default class UploadList extends React.Component<UploadListProps, any> {
|
|
|
|
if (listType === 'picture' || listType === 'picture-card') {
|
|
|
|
if (listType === 'picture' || listType === 'picture-card') {
|
|
|
|
if (file.status === 'uploading' || (!file.thumbUrl && !file.url)) {
|
|
|
|
if (file.status === 'uploading' || (!file.thumbUrl && !file.url)) {
|
|
|
|
if (listType === 'picture-card') {
|
|
|
|
if (listType === 'picture-card') {
|
|
|
|
icon = <div className={`${prefixCls}-list-item-uploading-text`}>Uploading...</div>;
|
|
|
|
icon = <div className={`${prefixCls}-list-item-uploading-text`}>{locale.uploading}</div>;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
icon = <Icon className={`${prefixCls}-list-item-thumbnail`} type="picture" />;
|
|
|
|
icon = <Icon className={`${prefixCls}-list-item-thumbnail`} type="picture" />;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -133,16 +133,16 @@ export default class UploadList extends React.Component<UploadListProps, any> {
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
style={style}
|
|
|
|
style={style}
|
|
|
|
onClick={e => this.handlePreview(file, e)}
|
|
|
|
onClick={e => this.handlePreview(file, e)}
|
|
|
|
title="Preview file"
|
|
|
|
title={locale.previewFile}
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<Icon type="eye-o" />
|
|
|
|
<Icon type="eye-o" />
|
|
|
|
</a>
|
|
|
|
</a>
|
|
|
|
) : null;
|
|
|
|
) : null;
|
|
|
|
const removeIcon = showRemoveIcon ? (
|
|
|
|
const removeIcon = showRemoveIcon ? (
|
|
|
|
<Icon type="delete" title="Remove file" onClick={() => this.handleClose(file)} />
|
|
|
|
<Icon type="delete" title={locale.removeFile} onClick={() => this.handleClose(file)} />
|
|
|
|
) : null;
|
|
|
|
) : null;
|
|
|
|
const removeIconCross = showRemoveIcon ? (
|
|
|
|
const removeIconCross = showRemoveIcon ? (
|
|
|
|
<Icon type="cross" title="Remove file" onClick={() => this.handleClose(file)} />
|
|
|
|
<Icon type="cross" title={locale.removeFile} onClick={() => this.handleClose(file)} />
|
|
|
|
) : null;
|
|
|
|
) : null;
|
|
|
|
const actions = (listType === 'picture-card' && file.status !== 'uploading')
|
|
|
|
const actions = (listType === 'picture-card' && file.status !== 'uploading')
|
|
|
|
? <span className={`${prefixCls}-list-item-actions`}>{previewIcon}{removeIcon}</span>
|
|
|
|
? <span className={`${prefixCls}-list-item-actions`}>{previewIcon}{removeIcon}</span>
|
|
|
@ -160,7 +160,7 @@ export default class UploadList extends React.Component<UploadListProps, any> {
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
if (file.status === 'error') {
|
|
|
|
if (file.status === 'error') {
|
|
|
|
const message = file.response || (file.error && file.error.statusText) || 'Upload Error';
|
|
|
|
const message = file.response || (file.error && file.error.statusText) || locale.uploadError;
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<Tooltip title={message} key={file.uid}>
|
|
|
|
<Tooltip title={message} key={file.uid}>
|
|
|
|
{item}
|
|
|
|
{item}
|
|
|
|