Skip to content

Commit

Permalink
docs: format api message/notification/progress (ant-design#25388)
Browse files Browse the repository at this point in the history
  • Loading branch information
xrkffgg authored Jul 2, 2020
1 parent 674ee73 commit cbd9332
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 62 deletions.
22 changes: 11 additions & 11 deletions components/message/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ This components provides some static methods, with usage and arguments as follow

| Argument | Description | Type | Default |
| --- | --- | --- | --- |
| content | content of the message | string\|ReactNode\|config | - |
| duration | time(seconds) before auto-dismiss, don't dismiss if set to 0 | number | 1.5 |
| onClose | Specify a function that will be called when the message is closed | Function | - |
| content | The content of the message | string \| ReactNode \| config | - |
| duration | Time(seconds) before auto-dismiss, don't dismiss if set to 0 | number | 1.5 |
| onClose | Specify a function that will be called when the message is closed | function | - |

`afterClose` can be called in thenable interface:

Expand All @@ -51,13 +51,13 @@ The properties of config are as follows:

| Property | Description | Type | Default |
| --- | --- | --- | --- |
| content | content of the message | ReactNode | - |
| duration | time(seconds) before auto-dismiss, don't dismiss if set to 0 | number | 3 |
| content | The content of the message | ReactNode | - |
| duration | Time(seconds) before auto-dismiss, don't dismiss if set to 0 | number | 3 |
| onClose | Specify a function that will be called when the message is closed | function | - |
| icon | Customized Icon | ReactNode | - |
| key | The unique identifier of the Message | string\|number | - |
| key | The unique identifier of the Message | string \| number | - |
| className | Customized CSS class | string | - |
| style | Customized inline style | [React.CSSProperties](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e434515761b36830c3e58a970abf5186f005adac/types/react/index.d.ts#L794) | - |
| style | Customized inline style | [CSSProperties](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e434515761b36830c3e58a970abf5186f005adac/types/react/index.d.ts#L794) | - |

### Global static methods

Expand All @@ -83,8 +83,8 @@ message.config({

| Argument | Description | Type | Default |
| --- | --- | --- | --- |
| duration | time before auto-dismiss, in seconds | number | 1.5 |
| duration | Time before auto-dismiss, in seconds | number | 1.5 |
| getContainer | Return the mount node for Message | () => HTMLElement | () => document.body |
| maxCount | max message show, drop oldest if exceed limit | number | - |
| top | distance from top | number | 24 |
| rtl | whether to enable RTL mode | boolean | false |
| maxCount | Max message show, drop oldest if exceed limit | number | - |
| top | Distance from top | number | 24 |
| rtl | Whether to enable RTL mode | boolean | false |
18 changes: 9 additions & 9 deletions components/message/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ cover: https://gw.alipayobjects.com/zos/alicdn/hAkKTIW0K/Message.svg
- `message.warn(content, [duration], onClose)` // alias of warning
- `message.loading(content, [duration], onClose)`

| 参数 | 说明 | 类型 | 默认值 |
| -------- | --------------------------------------------- | ------------------------- | ------ |
| content | 提示内容 | string\|ReactNode\|config | - |
| duration | 自动关闭的延时,单位秒。设为 0 时不自动关闭 | number | 3 |
| onClose | 关闭时触发的回调函数 | Function | - |
| 参数 | 说明 | 类型 | 默认值 |
| -------- | ------------------------------------------- | ----------------------------- | ------ |
| content | 提示内容 | string \| ReactNode \| config | - |
| duration | 自动关闭的延时,单位秒。设为 0 时不自动关闭 | number | 3 |
| onClose | 关闭时触发的回调函数 | function | - |

组件同时提供 promise 接口。

Expand All @@ -53,12 +53,12 @@ cover: https://gw.alipayobjects.com/zos/alicdn/hAkKTIW0K/Message.svg
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| content | 提示内容 | ReactNode | - |
| duration | 自动关闭的延时,单位秒。设为 0 时不自动关闭 | number | 3 |
| onClose | 关闭时触发的回调函数 | Function | - |
| duration | 自动关闭的延时,单位秒。设为 0 时不自动关闭 | number | 3 |
| onClose | 关闭时触发的回调函数 | function | - |
| icon | 自定义图标 | ReactNode | - |
| key | 当前提示的唯一标志 | string\|number | - |
| key | 当前提示的唯一标志 | string \| number | - |
| className | 自定义 CSS class | string | - |
| style | 自定义内联样式 | [React.CSSProperties](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e434515761b36830c3e58a970abf5186f005adac/types/react/index.d.ts#L794) | - |
| style | 自定义内联样式 | [CSSProperties](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e434515761b36830c3e58a970abf5186f005adac/types/react/index.d.ts#L794) | - |

### 全局方法

Expand Down
24 changes: 12 additions & 12 deletions components/notification/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,21 @@ The properties of config are as follows:

| Property | Description | Type | Default |
| --- | --- | --- | --- |
| bottom | Distance from the bottom of the viewport, when `placement` is `bottomRight` or `bottomLeft` (unit: pixels). | number | 24 |
| bottom | Distance from the bottom of the viewport, when `placement` is `bottomRight` or `bottomLeft` (unit: pixels) | number | 24 |
| btn | Customized close button | ReactNode | - |
| className | Customized CSS class | string | - |
| description | The content of notification box (required) | string\|ReactNode | - |
| description | The content of notification box (required) | string \| ReactNode | - |
| duration | Time in seconds before Notification is closed. When set to 0 or null, it will never be closed automatically | number | 4.5 |
| getContainer | Return the mount node for Notification | () => HTMLNode | () => document.body |
| icon | Customized icon | ReactNode | - |
| closeIcon | custom close icon | ReactNode | - |
| closeIcon | Custom close icon | ReactNode | - |
| key | The unique identifier of the Notification | string | - |
| message | The title of notification box (required) | string\|ReactNode | - |
| onClose | Trigger when notification closed | Function | - |
| onClick | Specify a function that will be called when the notification is clicked | Function | - |
| message | The title of notification box (required) | string \| ReactNode | - |
| onClose | Trigger when notification closed | function | - |
| onClick | Specify a function that will be called when the notification is clicked | function | - |
| placement | Position of Notification, can be one of `topLeft` `topRight` `bottomLeft` `bottomRight` | string | `topRight` |
| style | Customized inline style | [React.CSSProperties](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e434515761b36830c3e58a970abf5186f005adac/types/react/index.d.ts#L794) | - |
| top | Distance from the top of the viewport, when `placement` is `topRight` or `topLeft` (unit: pixels). | number | 24 |
| style | Customized inline style | [CSSProperties](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e434515761b36830c3e58a970abf5186f005adac/types/react/index.d.ts#L794) | - |
| top | Distance from the top of the viewport, when `placement` is `topRight` or `topLeft` (unit: pixels) | number | 24 |

`notification` also provides a global `config()` method that can be used for specifying the default options. Once this method is used, all the notification boxes will take into account these globally defined options when displaying.

Expand All @@ -66,13 +66,13 @@ notification.config({

| Property | Description | Type | Default |
| --- | --- | --- | --- |
| bottom | Distance from the bottom of the viewport, when `placement` is `bottomRight` or `bottomLeft` (unit: pixels). | number | 24 |
| closeIcon | custom close icon | ReactNode | - |
| bottom | Distance from the bottom of the viewport, when `placement` is `bottomRight` or `bottomLeft` (unit: pixels) | number | 24 |
| closeIcon | Custom close icon | ReactNode | - |
| duration | Time in seconds before Notification is closed. When set to 0 or null, it will never be closed automatically | number | 4.5 |
| getContainer | Return the mount node for Notification | () => HTMLNode | () => document.body |
| placement | Position of Notification, can be one of `topLeft` `topRight` `bottomLeft` `bottomRight` | string | `topRight` |
| top | Distance from the top of the viewport, when `placement` is `topRight` or `topLeft` (unit: pixels). | number | 24 |
| rtl | whether to enable RTL mode | boolean | false |
| top | Distance from the top of the viewport, when `placement` is `topRight` or `topLeft` (unit: pixels) | number | 24 |
| rtl | Whether to enable RTL mode | boolean | false |

## FAQ

Expand Down
18 changes: 9 additions & 9 deletions components/notification/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ config 参数如下:
| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| btn | 自定义关闭按钮 | ReactNode | - |
| bottom | 消息从底部弹出时,距离底部的位置,单位像素 | number | 24 |
| bottom | 消息从底部弹出时,距离底部的位置,单位像素 | number | 24 |
| className | 自定义 CSS class | string | - |
| closeIcon | 自定义关闭图标 | ReactNode | - |
| description | 通知提醒内容,必选 | string\|ReactNode | - |
| description | 通知提醒内容,必选 | string \| ReactNode | - |
| duration | 默认 4.5 秒后自动关闭,配置为 null 则不自动关闭 | number | 4.5 |
| getContainer | 配置渲染节点的输出位置 | () => HTMLNode | () => document.body |
| icon | 自定义图标 | ReactNode | - |
| key | 当前通知唯一标志 | string | - |
| message | 通知提醒标题,必选 | string\|ReactNode | - |
| onClose | 当通知关闭时触发 | Function | - |
| onClick | 点击通知时触发的回调函数 | Function | - |
| message | 通知提醒标题,必选 | string \| ReactNode | - |
| onClose | 当通知关闭时触发 | function | - |
| onClick | 点击通知时触发的回调函数 | function | - |
| placement | 弹出位置,可选 `topLeft` `topRight` `bottomLeft` `bottomRight` | string | `topRight` |
| style | 自定义内联样式 | [React.CSSProperties](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e434515761b36830c3e58a970abf5186f005adac/types/react/index.d.ts#L794) | - |
| top | 消息从顶部弹出时,距离顶部的位置,单位像素 | number | 24 |
| style | 自定义内联样式 | [CSSProperties](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/e434515761b36830c3e58a970abf5186f005adac/types/react/index.d.ts#L794) | - |
| top | 消息从顶部弹出时,距离顶部的位置,单位像素 | number | 24 |

还提供了一个全局配置方法,在调用前提前配置,全局一次生效。

Expand All @@ -67,12 +67,12 @@ notification.config({

| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| bottom | 消息从底部弹出时,距离底部的位置,单位像素 | number | 24 |
| bottom | 消息从底部弹出时,距离底部的位置,单位像素 | number | 24 |
| closeIcon | 自定义关闭图标 | ReactNode | - |
| duration | 默认自动关闭延时,单位秒 | number | 4.5 |
| getContainer | 配置渲染节点的输出位置 | () => HTMLNode | () => document.body |
| placement | 弹出位置,可选 `topLeft` `topRight` `bottomLeft` `bottomRight` | string | `topRight` |
| top | 消息从顶部弹出时,距离顶部的位置,单位像素 | number | 24 |
| top | 消息从顶部弹出时,距离顶部的位置,单位像素 | number | 24 |
| rtl | 是否开启 RTL 模式 | boolean | false |

## FAQ
Expand Down
38 changes: 19 additions & 19 deletions components/progress/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,37 @@ Properties that shared by all types.

| Property | Description | Type | Default |
| --- | --- | --- | --- |
| type | to set the type, options: `line` `circle` `dashboard` | string | `line` |
| format | template function of the content | function(percent, successPercent) | `percent => percent + '%'` |
| percent | to set the completion percentage | number | 0 |
| showInfo | whether to display the progress value and the status icon | boolean | true |
| status | to set the status of the Progress, options: `success` `exception` `normal` `active`(line only) | string | - |
| strokeLinecap | to set the style of the progress linecap | `round` \| `square` | `round` |
| strokeColor | color of progress bar | string | - |
| trailColor | color of unfilled part | string | - |
| success | configs of successfully progress bar | { percent: number, strokeColor: string } | - |
| type | To set the type, options: `line` `circle` `dashboard` | string | `line` |
| format | The template function of the content | function(percent, successPercent) | (percent) => percent + `%` |
| percent | To set the completion percentage | number | 0 |
| showInfo | Whether to display the progress value and the status icon | boolean | true |
| status | To set the status of the Progress, options: `success` `exception` `normal` `active`(line only) | string | - |
| strokeLinecap | To set the style of the progress linecap | `round` \| `square` | `round` |
| strokeColor | The color of progress bar | string | - |
| trailColor | The color of unfilled part | string | - |
| success | Configs of successfully progress bar | { percent: number, strokeColor: string } | - |

### `type="line"`

| Property | Description | Type | Default |
| --- | --- | --- | --- |
| strokeWidth | to set the width of the progress bar, unit: `px` | number | 10 |
| strokeColor | color of progress bar, render `linear-gradient` when passing an object | string \| { from: string; to: string; direction: string } | - |
| steps | the total step count | number | - |
| strokeWidth | To set the width of the progress bar, unit: `px` | number | 10 |
| strokeColor | The color of progress bar, render `linear-gradient` when passing an object | string \| { from: string; to: string; direction: string } | - |
| steps | The total step count | number | - |

### `type="circle"`

| Property | Description | Type | Default |
| --- | --- | --- | --- |
| width | to set the canvas width of the circular progress, unit: `px` | number | 132 |
| strokeWidth | to set the width of the circular progress, unit: percentage of the canvas width | number | 6 |
| strokeColor | color of circular progress, render `linear-gradient` when passing an object | string \| object | - |
| width | To set the canvas width of the circular progress, unit: `px` | number | 132 |
| strokeWidth | To set the width of the circular progress, unit: percentage of the canvas width | number | 6 |
| strokeColor | The color of circular progress, render `linear-gradient` when passing an object | string \| object | - |

### `type="dashboard"`

| Property | Description | Type | Default |
| --- | --- | --- | --- |
| width | to set the canvas width of the dashboard progress, unit: `px` | number | 132 |
| strokeWidth | to set the width of the dashboard progress, unit: percentage of the canvas width | number | 6 |
| gapDegree | the gap degree of half circle, 0 ~ 295 | number | 75 |
| gapPosition | the gap position, options: `top` `bottom` `left` `right` | string | `bottom` |
| width | To set the canvas width of the dashboard progress, unit: `px` | number | 132 |
| strokeWidth | To set the width of the dashboard progress, unit: percentage of the canvas width | number | 6 |
| gapDegree | The gap degree of half circle, 0 ~ 295 | number | 75 |
| gapPosition | The gap position, options: `top` `bottom` `left` `right` | string | `bottom` |
4 changes: 2 additions & 2 deletions components/progress/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ cover: https://gw.alipayobjects.com/zos/alicdn/xqsDu4ZyR/Progress.svg
| 属性 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| type | 类型,可选 `line` `circle` `dashboard` | string | `line` |
| format | 内容的模板函数 | function(percent, successPercent) | `percent => percent + '%'` |
| format | 内容的模板函数 | function(percent, successPercent) | (percent) => percent + `%` |
| percent | 百分比 | number | 0 |
| showInfo | 是否显示进度数值或状态图标 | boolean | true |
| status | 状态,可选:`success` `exception` `normal` `active`(仅限 line) | string | - |
| strokeLinecap | - | `round` \| `square` | `round` |
| strokeLinecap | 进度条的样式 | `round` \| `square` | `round` |
| strokeColor | 进度条的色彩 | string | - |
| trailColor | 未完成的分段的颜色 | string | - |
| success | 成功进度条相关配置 | { percent: number, strokeColor: string } | - |
Expand Down

0 comments on commit cbd9332

Please sign in to comment.