Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance: change Dialog getContainer type #4028

Merged
merged 1 commit into from
Sep 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/dialog/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Mask from '../mask'
import { Action, DialogActionButton } from './dialog-action-button'
import Image from '../image'
import Space from '../space'
import { GetContainer } from '../../utils/render-to-container'

const classPrefix = `adm-dialog`

Expand All @@ -21,7 +22,7 @@ export interface DialogProps {
onClose?: () => void
closeOnMaskClick?: boolean
visible?: boolean
getContainer?: HTMLElement | (() => HTMLElement) | undefined
getContainer?: GetContainer
bodyStyle?: React.CSSProperties
bodyClassName?: string
maskStyle?: React.CSSProperties
Expand Down
36 changes: 18 additions & 18 deletions src/components/dialog/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@

## Dialog

| 属性 | 说明 | 类型 | 默认值 |
| ---------------- | -------------------------------------------------------- | ------------------------------------------------- | --------------- |
| afterClose | `Dialog` 完全关闭后的回调 | `() => void` | - |
| image | 图片 `url` | `string` | - |
| header | 顶部区域 | `string` | - |
| title | 对话框标题 | `React.ReactNode` | - |
| content | 对话框内容 | `React.ReactNode` | - |
| actions | 操作按钮列表,可以传入二级数组来实现同一行内并排多个按钮 | `(Action \| Action[])[]` | `[]` |
| onAction | 点击操作按钮时触发 | `(action: Action, index: number) => void` | - |
| closeOnAction | 点击操作按钮后后是否关闭 | `boolean` | `false` |
| onClose | 关闭时触发 | `() => void` | - |
| closeOnMaskClick | 是否支持点击遮罩关闭对话框 | `boolean` | `false` |
| visible | 显示隐藏 | `boolean` | `false` |
| getContainer | 自定义对话框的父容器 | `HTMLElement \| (() => HTMLElement) \| undefined` | `document.body` |
| bodyStyle | `Dialog` 内容样式 | `React.CSSProperties` | - |
| bodyClassName | `Dialog` 内容类名 | `string` | - |
| maskStyle | `Dialog` 遮罩样式 | `React.CSSProperties` | - |
| maskClassName | `Dialog` 遮罩类名 | `string` | - |
| 属性 | 说明 | 类型 | 默认值 |
| ---------------- | -------------------------------------------------------- | -------------------------------------------- | --------------- |
| afterClose | `Dialog` 完全关闭后的回调 | `() => void` | - |
| image | 图片 `url` | `string` | - |
| header | 顶部区域 | `string` | - |
| title | 对话框标题 | `React.ReactNode` | - |
| content | 对话框内容 | `React.ReactNode` | - |
| actions | 操作按钮列表,可以传入二级数组来实现同一行内并排多个按钮 | `(Action \| Action[])[]` | `[]` |
| onAction | 点击操作按钮时触发 | `(action: Action, index: number) => void` | - |
| closeOnAction | 点击操作按钮后后是否关闭 | `boolean` | `false` |
| onClose | 关闭时触发 | `() => void` | - |
| closeOnMaskClick | 是否支持点击遮罩关闭对话框 | `boolean` | `false` |
| visible | 显示隐藏 | `boolean` | `false` |
| getContainer | 自定义对话框的父容器 | `HTMLElement \| (() => HTMLElement) \| null` | `document.body` |
| bodyStyle | `Dialog` 内容样式 | `React.CSSProperties` | - |
| bodyClassName | `Dialog` 内容类名 | `string` | - |
| maskStyle | `Dialog` 遮罩样式 | `React.CSSProperties` | - |
| maskClassName | `Dialog` 遮罩类名 | `string` | - |

### Action

Expand Down