Browse Source

Add getContainer for message and notification, close #5019 (#5066)

pull/5084/head
偏右 8 years ago
committed by GitHub
parent
commit
c552b315bc
  1. 1
      components/message/index.en-US.md
  2. 1
      components/message/index.tsx
  3. 1
      components/message/index.zh-CN.md
  4. 2
      components/notification/index.en-US.md
  5. 1
      components/notification/index.tsx
  6. 1
      components/notification/index.zh-CN.md
  7. 2
      package.json

1
components/message/index.en-US.md

@ -27,6 +27,7 @@ This components provides 4 static methods, with arguments as following:
|------------|------------------------------------|--------------------------|--------------|
| content | content of the message | string\|ReactNode | - |
| duration | time before auto-dismiss,in seconds | number | 1.5 |
| getContainer | specify render container | () => HTMLElement | () => document.body |
Methods for global configuration and destruction are also provided:

1
components/message/index.tsx

@ -61,6 +61,7 @@ export interface ConfigOptions {
top?: number;
duration?: number;
prefixCls?: string;
getContainer?: () => HTMLElement;
}
export default {

1
components/message/index.zh-CN.md

@ -28,6 +28,7 @@ title: Message
|------------|----------------|--------------------------|--------------|
| content | 提示内容 | string\|ReactNode | - |
| duration | 自动关闭的延时,单位秒 | number | 1.5 |
| getContainer | 配置渲染节点的输出位置 | () => HTMLElement | () => document.body |
还提供了全局配置和全局销毁方法:

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

@ -38,7 +38,7 @@ The properties of config are as follows:
| onClose | Specify a function that will be called after clicking the default close button | Function | - |
| duration | A notification box is closed after 4.5s by default. When specifying `duration` to null or 0, it will never be closed automatically | number | 4.5 |
| placement | To set the position, which can be one of `topLeft` `topRight` `bottomLeft` `bottomRight` | string | topRight |
| getContainer | specify render container | () => HTMLNode | () => document.body |
`notification` also provide 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 before displaying.

1
components/notification/index.tsx

@ -53,6 +53,7 @@ export interface ArgsProps {
duration?: number;
icon?: React.ReactNode;
placement?: notificationPlacement;
getContainer?: () => HTMLElement;
}
export interface ConfigProps {

1
components/notification/index.zh-CN.md

@ -38,6 +38,7 @@ config 参数如下:
| onClose | 点击默认关闭按钮时触发的回调函数 | Function | - |
| duration | 默认 4.5 秒后自动关闭,配置为 null 则不自动关闭 | number | 4.5 |
| placement | 弹出位置,可选 `topLeft` `topRight` `bottomLeft` `bottomRight` | string | topRight |
| getContainer | 配置渲染节点的输出位置 | () => HTMLNode | () => document.body |
还提供了一个全局配置方法,在调用前提前配置,全局一次生效。

2
package.json

@ -52,7 +52,7 @@
"rc-form": "~1.3.0",
"rc-input-number": "~3.1.1",
"rc-menu": "~5.0.9",
"rc-notification": "~1.3.4",
"rc-notification": "~1.4.0",
"rc-pagination": "~1.7.0",
"rc-progress": "~2.0.1",
"rc-radio": "~2.0.0",

Loading…
Cancel
Save