From c552b315bc3e549f87a5159a236007e9f6d12f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=8F=E5=8F=B3?= Date: Mon, 27 Feb 2017 13:39:37 +0800 Subject: [PATCH] Add getContainer for message and notification, close #5019 (#5066) --- components/message/index.en-US.md | 1 + components/message/index.tsx | 1 + components/message/index.zh-CN.md | 1 + components/notification/index.en-US.md | 2 +- components/notification/index.tsx | 1 + components/notification/index.zh-CN.md | 1 + package.json | 2 +- 7 files changed, 7 insertions(+), 2 deletions(-) diff --git a/components/message/index.en-US.md b/components/message/index.en-US.md index 88c7063f5b..b2e044c056 100644 --- a/components/message/index.en-US.md +++ b/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: diff --git a/components/message/index.tsx b/components/message/index.tsx index 527776d8c5..351c1e69a4 100755 --- a/components/message/index.tsx +++ b/components/message/index.tsx @@ -61,6 +61,7 @@ export interface ConfigOptions { top?: number; duration?: number; prefixCls?: string; + getContainer?: () => HTMLElement; } export default { diff --git a/components/message/index.zh-CN.md b/components/message/index.zh-CN.md index 23205b3ad3..625001a6f4 100644 --- a/components/message/index.zh-CN.md +++ b/components/message/index.zh-CN.md @@ -28,6 +28,7 @@ title: Message |------------|----------------|--------------------------|--------------| | content | 提示内容 | string\|ReactNode | - | | duration | 自动关闭的延时,单位秒 | number | 1.5 | +| getContainer | 配置渲染节点的输出位置 | () => HTMLElement | () => document.body | 还提供了全局配置和全局销毁方法: diff --git a/components/notification/index.en-US.md b/components/notification/index.en-US.md index 559be1388b..563bdff5be 100644 --- a/components/notification/index.en-US.md +++ b/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. diff --git a/components/notification/index.tsx b/components/notification/index.tsx index 781ba78e8a..bf304a4c27 100755 --- a/components/notification/index.tsx +++ b/components/notification/index.tsx @@ -53,6 +53,7 @@ export interface ArgsProps { duration?: number; icon?: React.ReactNode; placement?: notificationPlacement; + getContainer?: () => HTMLElement; } export interface ConfigProps { diff --git a/components/notification/index.zh-CN.md b/components/notification/index.zh-CN.md index f329e488b6..be6dc0d59c 100644 --- a/components/notification/index.zh-CN.md +++ b/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 | 还提供了一个全局配置方法,在调用前提前配置,全局一次生效。 diff --git a/package.json b/package.json index 1f42379f34..6feb4c78ab 100644 --- a/package.json +++ b/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",