docs: format api alert/drawer/modal (#25387)

This commit is contained in:
xrkffgg 2020-07-02 14:55:12 +08:00 committed by GitHub
parent af2cc506da
commit 674ee73a2f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 70 additions and 70 deletions

View File

@ -19,17 +19,17 @@ Alert component for feedback.
| afterClose | Called when close animation is finished | () => void | - | | afterClose | Called when close animation is finished | () => void | - |
| banner | Whether to show as banner | boolean | false | | banner | Whether to show as banner | boolean | false |
| closable | Whether Alert can be closed | boolean | - | | closable | Whether Alert can be closed | boolean | - |
| closeText | Close text to show | string\|ReactNode | - | | closeText | Close text to show | string \| ReactNode | - |
| description | Additional content of Alert | string\|ReactNode | - | | description | Additional content of Alert | string \| ReactNode | - |
| icon | Custom icon, effective when `showIcon` is `true` | ReactNode | - | | icon | Custom icon, effective when `showIcon` is true | ReactNode | - |
| message | Content of Alert | string\|ReactNode | - | | message | Content of Alert | string \| ReactNode | - |
| showIcon | Whether to show icon | boolean | false, in `banner` mode default is true | | showIcon | Whether to show icon | boolean | false, in `banner` mode default is true |
| type | Type of Alert styles, options: `success`, `info`, `warning`, `error` | string | `info`, in `banner` mode default is `warning` | | type | Type of Alert styles, options: `success`, `info`, `warning`, `error` | string | `info`, in `banner` mode default is `warning` |
| onClose | Callback when Alert is closed | (e: MouseEvent) => void | - | | onClose | Callback when Alert is closed | (e: MouseEvent) => void | - |
### Alert.ErrorBoundary ### Alert.ErrorBoundary
| Property | Description | Type | Default | Version | | Property | Description | Type | Default | Version |
| ----------- | -------------------------------- | --------- | ------------------- | ------- | | ----------- | -------------------------------- | --------- | ----------------- | ------- |
| message | custom error message to show | ReactNode | `{{ error }}` | | | message | Custom error message to show | ReactNode | {{ error }} | |
| description | custom error description to show | ReactNode | `{{ error stack }}` | | | description | Custom error description to show | ReactNode | {{ error stack }} | |

View File

@ -20,10 +20,10 @@ cover: https://gw.alipayobjects.com/zos/alicdn/8emPa3fjl/Alert.svg
| afterClose | 关闭动画结束后触发的回调函数 | () => void | - | | afterClose | 关闭动画结束后触发的回调函数 | () => void | - |
| banner | 是否用作顶部公告 | boolean | false | | banner | 是否用作顶部公告 | boolean | false |
| closable | 默认不显示关闭按钮 | boolean | - | | closable | 默认不显示关闭按钮 | boolean | - |
| closeText | 自定义关闭按钮 | string\|ReactNode | - | | closeText | 自定义关闭按钮 | string \| ReactNode | - |
| description | 警告提示的辅助性文字介绍 | string\|ReactNode | - | | description | 警告提示的辅助性文字介绍 | string \| ReactNode | - |
| icon | 自定义图标,`showIcon` 为 `true` 时有效 | ReactNode | - | | icon | 自定义图标,`showIcon` 为 true 时有效 | ReactNode | - |
| message | 警告提示内容 | string\|ReactNode | - | | message | 警告提示内容 | string \| ReactNode | - |
| showIcon | 是否显示辅助图标 | boolean | false`banner` 模式下默认值为 true | | showIcon | 是否显示辅助图标 | boolean | false`banner` 模式下默认值为 true |
| type | 指定警告提示的样式,有四种选择 `success`、`info`、`warning`、`error` | string | `info``banner` 模式下默认值为 `warning` | | type | 指定警告提示的样式,有四种选择 `success`、`info`、`warning`、`error` | string | `info``banner` 模式下默认值为 `warning` |
| onClose | 关闭时触发的回调函数 | (e: MouseEvent) => void | - | | onClose | 关闭时触发的回调函数 | (e: MouseEvent) => void | - |
@ -32,5 +32,5 @@ cover: https://gw.alipayobjects.com/zos/alicdn/8emPa3fjl/Alert.svg
| 参数 | 说明 | 类型 | 默认值 | 版本 | | 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| message | 自定义错误标题,如果未指定会展示原生报错信息 | ReactNode | `{{ error }}` | | | message | 自定义错误标题,如果未指定会展示原生报错信息 | ReactNode | {{ error }} | |
| description | 自定义错误内容,如果未指定会展示报错堆栈 | ReactNode | `{{ error stack }}` | | | description | 自定义错误内容,如果未指定会展示报错堆栈 | ReactNode | {{ error stack }} | |

View File

@ -20,27 +20,27 @@ A Drawer is a panel that is typically overlaid on top of a page and slides in fr
| Props | Description | Type | Default | | Props | Description | Type | Default |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| closable | Whether a close (x) button is visible on top right of the Drawer dialog or not. | boolean | true | | closable | Whether a close (x) button is visible on top right of the Drawer dialog or not | boolean | true |
| closeIcon | custom close icon | ReactNode | `<CloseOutlined />` | | closeIcon | Custom close icon | ReactNode | &lt;CloseOutlined /> |
| destroyOnClose | Whether to unmount child components on closing drawer or not. | boolean | false | | destroyOnClose | Whether to unmount child components on closing drawer or not | boolean | false |
| forceRender | Prerender Drawer component forcely | boolean | false | | forceRender | Prerender Drawer component forcely | boolean | false |
| getContainer | Return the mounted node for Drawer. | HTMLElement \| `() => HTMLElement` \| Selectors \| false | 'body' | | getContainer | Return the mounted node for Drawer | HTMLElement \| () => HTMLElement \| Selectors \| false | body |
| mask | Whether to show mask or not. | boolean | true | | mask | Whether to show mask or not | boolean | true |
| maskClosable | Clicking on the mask (area outside the Drawer) to close the Drawer or not. | boolean | true | | maskClosable | Clicking on the mask (area outside the Drawer) to close the Drawer or not | boolean | true |
| maskStyle | Style for Drawer's mask element. | CSSProperties | {} | | maskStyle | Style for Drawer's mask element | CSSProperties | {} |
| style | Style of wrapper element which **contains mask** compare to `drawerStyle` | CSSProperties | - | | style | Style of wrapper element which **contains mask** compare to `drawerStyle` | CSSProperties | - |
| drawerStyle | Style of the popup layer element | object | - | | drawerStyle | Style of the popup layer element | object | - |
| headerStyle | Style of the drawer header part | object | - | | headerStyle | Style of the drawer header part | object | - |
| bodyStyle | Style of the drawer content part | object | - | | bodyStyle | Style of the drawer content part | object | - |
| title | The title for Drawer. | string\|ReactNode | - | | title | The title for Drawer | string \| ReactNode | - |
| visible | Whether the Drawer dialog is visible or not. | boolean | false | | visible | Whether the Drawer dialog is visible or not | boolean | false |
| width | Width of the Drawer dialog. | string\|number | 256 | | width | Width of the Drawer dialog | string \| number | 256 |
| height | placement is `top` or `bottom`, height of the Drawer dialog. | string\|number | 256 | | height | Placement is `top` or `bottom`, height of the Drawer dialog | string \| number | 256 |
| className | The class name of the container of the Drawer dialog. | string | - | | className | The class name of the container of the Drawer dialog | string | - |
| zIndex | The `z-index` of the Drawer. | Number | 1000 | | zIndex | The `z-index` of the Drawer | number | 1000 |
| placement | The placement of the Drawer. | `top` \| `right` \| `bottom` \| `left` | `right` | | placement | The placement of the Drawer | `top` \| `right` \| `bottom` \| `left` | `right` |
| onClose | Specify a callback that will be called when a user clicks mask, close button or Cancel button. | function(e) | - | | onClose | Specify a callback that will be called when a user clicks mask, close button or Cancel button | function(e) | - |
| afterVisibleChange | Callback after the animation ends when switching drawers. | function(visible) | - | | afterVisibleChange | Callback after the animation ends when switching drawers | function(visible) | - |
| keyboard | Whether support press esc to close | boolean | true | | keyboard | Whether support press esc to close | boolean | true |
| footer | The footer for Drawer. | ReactNode | - | | footer | The footer for Drawer | ReactNode | - |
| footerStyle | Style of the drawer footer part. | CSSProperties | - | | footerStyle | Style of the drawer footer part | CSSProperties | - |

View File

@ -20,10 +20,10 @@ cover: https://gw.alipayobjects.com/zos/alicdn/7z8NJQhFb/Drawer.svg
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| closable | 是否显示右上角的关闭按钮 | boolean | true | | closable | 是否显示右上角的关闭按钮 | boolean | true |
| closeIcon | 自定义关闭图标 | ReactNode | `<CloseOutlined />` | | closeIcon | 自定义关闭图标 | ReactNode | &lt;CloseOutlined /> |
| destroyOnClose | 关闭时销毁 Drawer 里的子元素 | boolean | false | | destroyOnClose | 关闭时销毁 Drawer 里的子元素 | boolean | false |
| forceRender | 预渲染 Drawer 内元素 | boolean | false | | forceRender | 预渲染 Drawer 内元素 | boolean | false |
| getContainer | 指定 Drawer 挂载的 HTML 节点, false 为挂载在当前 dom | HTMLElement \| `() => HTMLElement` \| Selectors \| false | 'body' | | getContainer | 指定 Drawer 挂载的 HTML 节点, false 为挂载在当前 dom | HTMLElement \| () => HTMLElement \| Selectors \| false | body |
| maskClosable | 点击蒙层是否允许关闭 | boolean | true | | maskClosable | 点击蒙层是否允许关闭 | boolean | true |
| mask | 是否展示遮罩 | boolean | true | | mask | 是否展示遮罩 | boolean | true |
| maskStyle | 遮罩样式 | CSSProperties | {} | | maskStyle | 遮罩样式 | CSSProperties | {} |

View File

@ -15,30 +15,30 @@ When requiring users to interact with the application, but without jumping to a
| Property | Description | Type | Default | | Property | Description | Type | Default |
| --- | --- | --- | --- | | --- | --- | --- | --- |
| afterClose | Specify a function that will be called when modal is closed completely. | function | - | | afterClose | Specify a function that will be called when modal is closed completely | function | - |
| bodyStyle | Body style for modal body element. Such as height, padding etc. | CSSProperties | {} | | bodyStyle | Body style for modal body element. Such as height, padding etc | CSSProperties | {} |
| cancelText | Text of the Cancel button | string\|ReactNode | `Cancel` | | cancelText | Text of the Cancel button | string \| ReactNode | `Cancel` |
| centered | Centered Modal | boolean | false | | centered | Centered Modal | boolean | false |
| closable | Whether a close (x) button is visible on top right of the modal dialog or not | boolean | true | | closable | Whether a close (x) button is visible on top right of the modal dialog or not | boolean | true |
| closeIcon | custom close icon | ReactNode | `<CloseOutlined />` | | closeIcon | Custom close icon | ReactNode | &lt;CloseOutlined /> |
| confirmLoading | Whether to apply loading visual effect for OK button or not | boolean | false | | confirmLoading | Whether to apply loading visual effect for OK button or not | boolean | false |
| destroyOnClose | Whether to unmount child components on onClose | boolean | false | | destroyOnClose | Whether to unmount child components on onClose | boolean | false |
| footer | Footer content, set as `footer={null}` when you don't need default buttons | string\|ReactNode | OK and Cancel buttons | | footer | Footer content, set as `footer={null}` when you don't need default buttons | string \| ReactNode | (OK and Cancel buttons) |
| forceRender | Force render Modal | boolean | false | | forceRender | Force render Modal | boolean | false |
| getContainer | Return the mount node for Modal | HTMLElement \| `() => HTMLElement` \| Selectors \| false | document.body | | getContainer | Return the mount node for Modal | HTMLElement \| () => HTMLElement \| Selectors \| false | document.body |
| mask | Whether show mask or not. | 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 | true | | maskClosable | Whether to close the modal dialog when the mask (area outside the modal) is clicked | boolean | true |
| maskStyle | Style for modal's mask element. | object | {} | | maskStyle | Style for modal's mask element | object | {} |
| okText | Text of the OK button | string\|ReactNode | `OK` | | okText | Text of the OK button | string \| ReactNode | `OK` |
| okType | Button `type` of the OK button | string | `primary` | | okType | Button `type` of the OK button | string | `primary` |
| okButtonProps | The ok button props | [ButtonProps](/components/button/#API) | - | | okButtonProps | The ok button props | [ButtonProps](/components/button/#API) | - |
| cancelButtonProps | The cancel 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 | - | | style | Style of floating layer, typically used at least for adjusting the position | CSSProperties | - |
| title | The modal dialog's title | string\|ReactNode | - | | title | The modal dialog's title | string \| ReactNode | - |
| visible | Whether the modal dialog is visible or not | boolean | false | | visible | Whether the modal dialog is visible or not | boolean | false |
| width | Width of the modal dialog | string\|number | 520 | | width | Width of the modal dialog | string \| number | 520 |
| wrapClassName | The class name of the container of the modal dialog | string | - | | wrapClassName | The class name of the container of the modal dialog | string | - |
| zIndex | The `z-index` of the Modal | Number | 1000 | | zIndex | The `z-index` of the Modal | number | 1000 |
| onCancel | Specify a function that will be called when a user clicks mask, close button on top right or Cancel button | function(e) | - | | onCancel | Specify a function that will be called when a user clicks mask, close button on top right or Cancel button | function(e) | - |
| onOk | Specify a function that will be called when a user clicks the OK button | function(e) | - | | onOk | Specify a function that will be called when a user clicks the OK button | function(e) | - |
@ -62,12 +62,12 @@ The items listed above are all functions, expecting a settings object as paramet
| Property | Description | Type | Default | Version | | Property | Description | Type | Default | Version |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| autoFocusButton | Specify which button to autofocus | null\| `ok` \| `cancel` | `ok` | | | autoFocusButton | Specify which button to autofocus | null \| `ok` \| `cancel` | `ok` | |
| cancelText | Text of the Cancel button with Modal.confirm | string | `Cancel` | | | cancelText | Text of the Cancel button with Modal.confirm | string | `Cancel` | |
| centered | Centered Modal | boolean | false | | | centered | Centered Modal | boolean | false | |
| className | className of container | string | - | | | className | The className of container | string | - | |
| content | Content | string\|ReactNode | - | | | content | Content | string \| ReactNode | - | |
| icon | custom icon | ReactNode | [<QuestionCircle /\>](/components/icon/) | 3.12.0 | | icon | Custom icon | ReactNode | &lt;QuestionCircle /> | 3.12.0 |
| keyboard | Whether support press esc to close | boolean | true | | | keyboard | Whether support press esc to close | boolean | true | |
| mask | Whether show mask or not. | 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 | | | maskClosable | Whether to close the modal dialog when the mask (area outside the modal) is clicked | boolean | false | |
@ -75,9 +75,9 @@ The items listed above are all functions, expecting a settings object as paramet
| okType | Button `type` of the OK button | string | `primary` | | | okType | Button `type` of the OK button | string | `primary` | |
| okButtonProps | The ok button props | [ButtonProps](/components/button/#API) | - | | | okButtonProps | The ok button props | [ButtonProps](/components/button/#API) | - | |
| cancelButtonProps | The cancel button props | [ButtonProps](/components/button/#API) | - | | | cancelButtonProps | The cancel button props | [ButtonProps](/components/button/#API) | - | |
| title | Title | string\|ReactNode | - | | | title | Title | string \| ReactNode | - | |
| width | Width of the modal dialog | string\|number | 416 | | | width | Width of the modal dialog | string \| number | 416 | |
| zIndex | The `z-index` of the Modal | Number | 1000 | | | 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) | - | | | 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) | - | | | 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) | - | |

View File

@ -20,29 +20,29 @@ cover: https://gw.alipayobjects.com/zos/alicdn/3StSdUlSH/Modal.svg
| --- | --- | --- | --- | | --- | --- | --- | --- |
| afterClose | Modal 完全关闭后的回调 | function | - | | afterClose | Modal 完全关闭后的回调 | function | - |
| bodyStyle | Modal body 样式 | object | {} | | bodyStyle | Modal body 样式 | object | {} |
| cancelText | 取消按钮文字 | string\|ReactNode | 取消 | | cancelText | 取消按钮文字 | string \| ReactNode | `取消` |
| centered | 垂直居中展示 Modal | boolean | false | | centered | 垂直居中展示 Modal | boolean | false |
| closable | 是否显示右上角的关闭按钮 | boolean | true | | closable | 是否显示右上角的关闭按钮 | boolean | true |
| closeIcon | 自定义关闭图标 | ReactNode | `<CloseOutlined />` | | closeIcon | 自定义关闭图标 | ReactNode | &lt;CloseOutlined /> |
| confirmLoading | 确定按钮 loading | boolean | false | | confirmLoading | 确定按钮 loading | boolean | false |
| destroyOnClose | 关闭时销毁 Modal 里的子元素 | boolean | false | | destroyOnClose | 关闭时销毁 Modal 里的子元素 | boolean | false |
| footer | 底部内容,当不需要默认底部按钮时,可以设为 `footer={null}` | string\|ReactNode | 确定取消按钮 | | footer | 底部内容,当不需要默认底部按钮时,可以设为 `footer={null}` | string \| ReactNode | (确定取消按钮) |
| forceRender | 强制渲染 Modal | boolean | false | | forceRender | 强制渲染 Modal | boolean | false |
| getContainer | 指定 Modal 挂载的 HTML 节点, false 为挂载在当前 dom | HTMLElement \| `() => HTMLElement` \| Selectors \| false | document.body | | getContainer | 指定 Modal 挂载的 HTML 节点, false 为挂载在当前 dom | HTMLElement \| () => HTMLElement \| Selectors \| false | document.body |
| keyboard | 是否支持键盘 esc 关闭 | boolean | true | | keyboard | 是否支持键盘 esc 关闭 | boolean | true |
| mask | 是否展示遮罩 | boolean | true | | mask | 是否展示遮罩 | boolean | true |
| maskClosable | 点击蒙层是否允许关闭 | boolean | true | | maskClosable | 点击蒙层是否允许关闭 | boolean | true |
| maskStyle | 遮罩样式 | object | {} | | maskStyle | 遮罩样式 | object | {} |
| okText | 确认按钮文字 | string\|ReactNode | 确定 | | okText | 确认按钮文字 | string \| ReactNode | `确定` |
| okType | 确认按钮类型 | string | `primary` | | okType | 确认按钮类型 | string | `primary` |
| okButtonProps | ok 按钮 props | [ButtonProps](/components/button/#API) | - | | okButtonProps | ok 按钮 props | [ButtonProps](/components/button/#API) | - |
| cancelButtonProps | cancel 按钮 props | [ButtonProps](/components/button/#API) | - | | cancelButtonProps | cancel 按钮 props | [ButtonProps](/components/button/#API) | - |
| style | 可用于设置浮层的样式,调整浮层位置等 | CSSProperties | - | | style | 可用于设置浮层的样式,调整浮层位置等 | CSSProperties | - |
| title | 标题 | string\|ReactNode | - | | title | 标题 | string \| ReactNode | - |
| visible | 对话框是否可见 | boolean | - | | visible | 对话框是否可见 | boolean | - |
| width | 宽度 | string\|number | 520 | | width | 宽度 | string \| number | 520 |
| wrapClassName | 对话框外层容器的类名 | string | - | | wrapClassName | 对话框外层容器的类名 | string | - |
| zIndex | 设置 Modal 的 `z-index` | Number | 1000 | | zIndex | 设置 Modal 的 `z-index` | number | 1000 |
| onCancel | 点击遮罩层或右上角叉或取消按钮的回调 | function(e) | - | | onCancel | 点击遮罩层或右上角叉或取消按钮的回调 | function(e) | - |
| onOk | 点击确定回调 | function(e) | - | | onOk | 点击确定回调 | function(e) | - |
@ -66,20 +66,20 @@ cover: https://gw.alipayobjects.com/zos/alicdn/3StSdUlSH/Modal.svg
| 参数 | 说明 | 类型 | 默认值 | 版本 | | 参数 | 说明 | 类型 | 默认值 | 版本 |
| --- | --- | --- | --- | --- | | --- | --- | --- | --- | --- |
| autoFocusButton | 指定自动获得焦点的按钮 | null\| `ok` \| `cancel` | `ok` | | | autoFocusButton | 指定自动获得焦点的按钮 | null \| `ok` \| `cancel` | `ok` | |
| cancelText | 设置 Modal.confirm 取消按钮文字 | string | 取消 | | | cancelText | 设置 Modal.confirm 取消按钮文字 | string | `取消` | |
| centered | 垂直居中展示 Modal | boolean | false | | | centered | 垂直居中展示 Modal | boolean | false | |
| className | 容器类名 | string | - | | | className | 容器类名 | string | - | |
| content | 内容 | string\|ReactNode | - | | | content | 内容 | string \| ReactNode | - | |
| icon | 自定义图标 | ReactNode | [<QuestionCircle /\>](/components/icon/) | 3.12.0 | | icon | 自定义图标 | ReactNode | &lt;QuestionCircle /> | 3.12.0 |
| maskClosable | 点击蒙层是否允许关闭 | boolean | false | | | maskClosable | 点击蒙层是否允许关闭 | boolean | false | |
| okText | 确认按钮文字 | string | 确定 | | | okText | 确认按钮文字 | string | `确定` | |
| okType | 确认按钮类型 | string | `primary` | | | okType | 确认按钮类型 | string | `primary` | |
| okButtonProps | ok 按钮 props | [ButtonProps](/components/button/#API) | - | | | okButtonProps | ok 按钮 props | [ButtonProps](/components/button/#API) | - | |
| cancelButtonProps | cancel 按钮 props | [ButtonProps](/components/button/#API) | - | | | cancelButtonProps | cancel 按钮 props | [ButtonProps](/components/button/#API) | - | |
| title | 标题 | string\|ReactNode | - | | | title | 标题 | string \| ReactNode | - | |
| width | 宽度 | string\|number | 416 | | | width | 宽度 | string \| number | 416 | |
| zIndex | 设置 Modal 的 `z-index` | Number | 1000 | | | zIndex | 设置 Modal 的 `z-index` | number | 1000 | |
| onCancel | 取消回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭 | function(close) | - | | | onCancel | 取消回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭 | function(close) | - | |
| onOk | 点击确定回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭 | function(close) | - | | | onOk | 点击确定回调,参数为关闭函数,返回 promise 时 resolve 后自动关闭 | function(close) | - | |