Browse Source

fix: enhance upload custom progress bar (#24339)

* enhance customize progress bar in upload

- fix progress bar `type` could be overridden
- update demo

* update docs in upload customize progress bar

* update docs in upload
pull/24362/head
Teng YANG 5 years ago
committed by GitHub
parent
commit
b264589b77
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      components/upload/UploadList.tsx
  2. 10
      components/upload/demo/customize-progress-bar.md
  3. 2
      components/upload/index.en-US.md
  4. 2
      components/upload/index.zh-CN.md

2
components/upload/UploadList.tsx

@ -177,7 +177,7 @@ export default class UploadList extends React.Component<UploadListProps, any> {
// show loading icon if upload progress listener is disabled
const loadingProgress =
'percent' in file ? (
<Progress type="line" {...progressProps} percent={file.percent} />
<Progress {...progressProps} type="line" percent={file.percent} />
) : null;
progress = (

10
components/upload/demo/customize-progress-bar.md

@ -1,18 +1,17 @@
---
order: 999
order: 15
title:
zh-CN: Customize Progress Bar
zh-CN: 自定义进度条样式
en-US: Customize Progress Bar
debug: true
---
## zh-CN
Customize Progress Bar with `progress` props.
使用 `progress` 属性自定义进度条样式。
## en-US
Customize Progress Bar with `progress` props.
Use `progress` for customize progress bar.
```jsx
import { Upload, message, Button } from 'antd';
@ -40,6 +39,7 @@ const props = {
'100%': '#87d068',
},
strokeWidth: 3,
format: percent => `${parseFloat(percent.toFixed(2))}%`,
},
};

2
components/upload/index.en-US.md

@ -43,7 +43,7 @@ Uploading is the process of publishing information (web pages, text, pictures, v
| onDownload | Click the method to download the file, pass the method to perform the method logic, do not pass the default jump to the new TAB. | Function(file): void | Jump to new TAB | |
| transformFile   | Customize transform file before request | Function(file): `string | Blob | File | Promise<string | Blob | File>` | - | |
| iconRender | custom show icon | (file: UploadFile, listType?: UploadListType) => React.ReactNode | - | |
| progress | custom progress bar | [progress props](/components/progress/) | `{ strokeWidth: 2, showInfo: false }` | |
| progress | custom progress bar | [ProgressProps](/components/progress/#API) (support `type="line"` only) | `{ strokeWidth: 2, showInfo: false }` | 4.3.0 |
### onChange

2
components/upload/index.zh-CN.md

@ -44,7 +44,7 @@ title: Upload
| onDownload | 点击下载文件时的回调,如果没有指定,则默认跳转到文件 url 对应的标签页。 | Function(file): void | 跳转新标签页 | |
| transformFile   | 在上传之前转换文件。支持返回一个 Promise 对象   | Function(file): `string | Blob | File | Promise<string | Blob | File>` | 无   | |
| iconRender | 自定义显示 icon | (file: UploadFile, listType?: UploadListType) => React.ReactNode | 无 | |
| progress | 自定义进度条样式 | [progress props](/components/progress/) | `{ strokeWidth: 2, showInfo: false }` | |
| progress | 自定义进度条样式 | [ProgressProps](/components/progress/#API) ( 仅支持 `type="line"` ) | `{ strokeWidth: 2, showInfo: false }` | 4.3.0 |
### onChange

Loading…
Cancel
Save