Skip to content

Commit

Permalink
docs(modal): improve (ant-design#24301)
Browse files Browse the repository at this point in the history
  • Loading branch information
hengkx authored May 20, 2020
1 parent fb839eb commit 6f1fe30
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 42 deletions.
44 changes: 22 additions & 22 deletions components/modal/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ When requiring users to interact with the application, but without jumping to a
| maskStyle | Style for modal's mask element. | object | {} |
| okText | Text of the OK button | string\|ReactNode | `OK` |
| okType | Button `type` of the OK button | string | `primary` |
| okButtonProps | The ok button props | [ButtonProps](/components/button) | - |
| cancelButtonProps | The cancel button props | [ButtonProps](/components/button) | - |
| okButtonProps | The ok button props | [ButtonProps](/components/button/#API) | - |
| cancelButtonProps | The cancel button props | [ButtonProps](/components/button/#API) | - |
| style | Style of floating layer, typically used at least for adjusting the position. | CSSProperties | - |
| title | The modal dialog's title | string\|ReactNode | - |
| visible | Whether the modal dialog is visible or not | boolean | false |
Expand All @@ -57,26 +57,26 @@ There are five ways to display the information based on the content's nature:

The items listed above are all functions, expecting a settings object as parameter. The properties of the object are follows:

| Property | Description | Type | Default |
| --- | --- | --- | --- |
| autoFocusButton | Specify which button to autofocus | null\| `ok` \| `cancel` | `ok` |
| cancelText | Text of the Cancel button with Modal.confirm | string | `Cancel` |
| centered | Centered Modal | Boolean | `false` |
| className | className of container | string | - |
| content | Content | string\|ReactNode | - |
| icon | custom icon (`Added in 3.12.0`) | ReactNode | `<QuestionCircle />` |
| keyboard | Whether support press esc to close | Boolean | true |
| mask | Whether show mask or not. | Boolean | true |
| maskClosable | Whether to close the modal dialog when the mask (area outside the modal) is clicked | Boolean | `false` |
| okText | Text of the OK button | string | `OK` |
| okType | Button `type` of the OK button | string | `primary` |
| okButtonProps | The ok button props | [ButtonProps](/components/button) | - |
| cancelButtonProps | The cancel button props | [ButtonProps](/components/button) | - |
| title | Title | string\|ReactNode | - |
| width | Width of the modal dialog | string\|number | 416 |
| zIndex | The `z-index` of the Modal | Number | 1000 |
| onCancel | Specify a function that will be called when the user clicks the Cancel button. The parameter of this function is a function whose execution should include closing the dialog. You can also just return a promise and when the promise is resolved, the modal dialog will also be closed | function(close) | - |
| onOk | Specify a function that will be called when the user clicks the OK button. The parameter of this function is a function whose execution should include closing the dialog. You can also just return a promise and when the promise is resolved, the modal dialog will also be closed | function(close) | - |
| Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- |
| autoFocusButton | Specify which button to autofocus | null\| `ok` \| `cancel` | `ok` | |
| cancelText | Text of the Cancel button with Modal.confirm | string | `Cancel` | |
| centered | Centered Modal | Boolean | `false` | |
| className | className of container | string | - | |
| content | Content | string\|ReactNode | - | |
| icon | custom icon | ReactNode | [<QuestionCircle /\>](/components/icon/) | 3.12.0 |
| keyboard | Whether support press esc to close | Boolean | true | |
| mask | Whether show mask or not. | Boolean | true | |
| maskClosable | Whether to close the modal dialog when the mask (area outside the modal) is clicked | Boolean | `false` | |
| okText | Text of the OK button | string | `OK` | |
| okType | Button `type` of the OK button | string | `primary` | |
| okButtonProps | The ok button props | [ButtonProps](/components/button/#API) | - | |
| cancelButtonProps | The cancel button props | [ButtonProps](/components/button/#API) | - | |
| title | Title | string\|ReactNode | - | |
| width | Width of the modal dialog | string\|number | 416 | |
| zIndex | The `z-index` of the Modal | Number | 1000 | |
| onCancel | Specify a function that will be called when the user clicks the Cancel button. The parameter of this function is a function whose execution should include closing the dialog. You can also just return a promise and when the promise is resolved, the modal dialog will also be closed | function(close) | - | |
| onOk | Specify a function that will be called when the user clicks the OK button. The parameter of this function is a function whose execution should include closing the dialog. You can also just return a promise and when the promise is resolved, the modal dialog will also be closed | function(close) | - | |

All the `Modal.method`s will return a reference, and then we can update and close the modal dialog by the reference.

Expand Down
40 changes: 20 additions & 20 deletions components/modal/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ title: Modal
| maskStyle | 遮罩样式 | object | {} |
| okText | 确认按钮文字 | string\|ReactNode | 确定 |
| okType | 确认按钮类型 | string | primary |
| okButtonProps | ok 按钮 props | [ButtonProps](/components/button) | - |
| cancelButtonProps | cancel 按钮 props | [ButtonProps](/components/button) | - |
| okButtonProps | ok 按钮 props | [ButtonProps](/components/button/#API) | - |
| cancelButtonProps | cancel 按钮 props | [ButtonProps](/components/button/#API) | - |
| style | 可用于设置浮层的样式,调整浮层位置等 | CSSProperties | - |
| title | 标题 | string\|ReactNode | - |
| visible | 对话框是否可见 | boolean | - |
Expand All @@ -61,24 +61,24 @@ title: Modal

以上均为一个函数,参数为 object,具体属性如下:

| 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- |
| autoFocusButton | 指定自动获得焦点的按钮 | null\| `ok` \| `cancel` | `ok` |
| cancelText | 设置 Modal.confirm 取消按钮文字 | string | 取消 |
| centered | 垂直居中展示 Modal | Boolean | `false` |
| className | 容器类名 | string | - |
| content | 内容 | string\|ReactNode | - |
| icon | 自定义图标(3.12.0 新增) | ReactNode | `<QuestionCircle />` |
| maskClosable | 点击蒙层是否允许关闭 | Boolean | `false` |
| okText | 确认按钮文字 | string | 确定 |
| okType | 确认按钮类型 | string | primary |
| okButtonProps | ok 按钮 props | [ButtonProps](/components/button) | - |
| cancelButtonProps | cancel 按钮 props | [ButtonProps](/components/button) | - |
| title | 标题 | string\|ReactNode | - |
| width | 宽度 | string\|number | 416 |
| zIndex | 设置 Modal 的 `z-index` | Number | 1000 |
| onCancel | 取消回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭 | function(close) | - |
| onOk | 点击确定回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭 | function(close) | - |
| 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- |
| autoFocusButton | 指定自动获得焦点的按钮 | null\| `ok` \| `cancel` | `ok` | |
| cancelText | 设置 Modal.confirm 取消按钮文字 | string | 取消 | |
| centered | 垂直居中展示 Modal | Boolean | `false` | |
| className | 容器类名 | string | - | |
| content | 内容 | string\|ReactNode | - | |
| icon | 自定义图标 | ReactNode | [<QuestionCircle /\>](/components/icon/) | 3.12.0 |
| maskClosable | 点击蒙层是否允许关闭 | Boolean | `false` | |
| okText | 确认按钮文字 | string | 确定 | |
| okType | 确认按钮类型 | string | primary | |
| okButtonProps | ok 按钮 props | [ButtonProps](/components/button/#API) | - | |
| cancelButtonProps | cancel 按钮 props | [ButtonProps](/components/button/#API) | - | |
| title | 标题 | string\|ReactNode | - | |
| width | 宽度 | string\|number | 416 | |
| zIndex | 设置 Modal 的 `z-index` | Number | 1000 | |
| onCancel | 取消回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭 | function(close) | - | |
| onOk | 点击确定回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭 | function(close) | - | |

以上函数调用后,会返回一个引用,可以通过该引用更新和关闭弹窗。

Expand Down

0 comments on commit 6f1fe30

Please sign in to comment.