fix: drawer wrapStyle position is incorrect and add drawerStyle #1699
parent
0dbea62fdf
commit
42787664ab
|
@ -1,26 +1,27 @@
|
||||||
## API
|
## API
|
||||||
|
|
||||||
| Property | Description | Type | Default |
|
| Property | Description | Type | Default | Version |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- |
|
||||||
| 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 | |
|
||||||
| 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 | |
|
||||||
| getContainer | Return the mounted node for Drawer. | HTMLElement \| `() => HTMLElement` \| Selectors | 'body' |
|
| getContainer | Return the mounted node for Drawer. | HTMLElement \| `() => HTMLElement` \| Selectors | '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. | object | {} |
|
| maskStyle | Style for Drawer's mask element. | object | {} | |
|
||||||
| title | The title for Drawer. | string\|slot | - |
|
| title | The title for Drawer. | string\|slot | - | |
|
||||||
| visible | Whether the Drawer dialog is visible or not. | boolean | false |
|
| visible | Whether the Drawer dialog is visible or not. | boolean | false | |
|
||||||
| wrapClassName | The class name of the container of the Drawer dialog. | string | - |
|
| wrapClassName | The class name of the container of the Drawer dialog. | string | - | |
|
||||||
| wrapStyle | The style of the container of the Drawer dialog. | object | - |
|
| wrapStyle | Style of wrapper element which **contains mask** compare to `drawerStyle` | object | - | |
|
||||||
| bodyStyle | Style of floating layer, typically used for adjusting its position. | object | - |
|
| drawerStyle | Style of the popup layer element | object | - | 1.4.11 |
|
||||||
| width | Width of the Drawer dialog. | string\|number | 256 |
|
| bodyStyle | Style of the drawer content part | object | - | |
|
||||||
| height | placement is `top` or `bottom`, height of the Drawer dialog. | string\|number | - |
|
| width | Width of the Drawer dialog. | string\|number | 256 | |
|
||||||
| zIndex | The `z-index` of the Drawer. | Number | 1000 |
|
| height | placement is `top` or `bottom`, height of the Drawer dialog. | string\|number | - | |
|
||||||
| placement | The placement of the Drawer. | 'top' \| 'right' \| 'bottom' \| 'left' | 'right' |
|
| zIndex | The `z-index` of the Drawer. | Number | 1000 | |
|
||||||
| handle | After setting, the drawer is directly mounted on the DOM, and you can control the drawer to open or close through this `handle`. | VNode \| slot | - |
|
| placement | The placement of the Drawer. | 'top' \| 'right' \| 'bottom' \| 'left' | 'right' | |
|
||||||
|
| handle | After setting, the drawer is directly mounted on the DOM, and you can control the drawer to open or close through this `handle`. | VNode \| slot | - | |
|
||||||
|
|
||||||
## Methods
|
## Methods
|
||||||
|
|
||||||
| Name | Description | Type | Default |
|
| Name | Description | Type | Default | Version |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- |
|
||||||
| close | Specify a callback that will be called when a user clicks mask, close button or Cancel button. | function(e) | - |
|
| close | Specify a callback that will be called when a user clicks mask, close button or Cancel button. | function(e) | - | |
|
||||||
|
|
|
@ -18,6 +18,7 @@ const Drawer = {
|
||||||
maskStyle: PropTypes.object,
|
maskStyle: PropTypes.object,
|
||||||
wrapStyle: PropTypes.object,
|
wrapStyle: PropTypes.object,
|
||||||
bodyStyle: PropTypes.object,
|
bodyStyle: PropTypes.object,
|
||||||
|
drawerStyle: PropTypes.object,
|
||||||
title: PropTypes.any,
|
title: PropTypes.any,
|
||||||
visible: PropTypes.bool,
|
visible: PropTypes.bool,
|
||||||
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def(256),
|
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number]).def(256),
|
||||||
|
@ -107,11 +108,12 @@ const Drawer = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getRcDrawerStyle() {
|
getRcDrawerStyle() {
|
||||||
const { zIndex, placement } = this.$props;
|
const { zIndex, placement, wrapStyle } = this.$props;
|
||||||
const { _push: push } = this.$data;
|
const { _push: push } = this.$data;
|
||||||
return {
|
return {
|
||||||
zIndex,
|
zIndex,
|
||||||
transform: push ? this.getPushTransform(placement) : undefined,
|
transform: push ? this.getPushTransform(placement) : undefined,
|
||||||
|
...wrapStyle,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
renderHeader(prefixCls) {
|
renderHeader(prefixCls) {
|
||||||
|
@ -142,7 +144,7 @@ const Drawer = {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
this.destroyClose = false;
|
this.destroyClose = false;
|
||||||
const { placement, bodyStyle, wrapStyle } = this.$props;
|
const { placement, bodyStyle, drawerStyle } = this.$props;
|
||||||
|
|
||||||
const containerStyle =
|
const containerStyle =
|
||||||
placement === 'left' || placement === 'right'
|
placement === 'left' || placement === 'right'
|
||||||
|
@ -162,7 +164,7 @@ const Drawer = {
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
class={`${prefixCls}-wrapper-body`}
|
class={`${prefixCls}-wrapper-body`}
|
||||||
style={{ ...containerStyle, ...wrapStyle }}
|
style={{ ...containerStyle, ...drawerStyle }}
|
||||||
onTransitionend={this.onDestroyTransitionEnd}
|
onTransitionend={this.onDestroyTransitionEnd}
|
||||||
>
|
>
|
||||||
{this.renderHeader(prefixCls)}
|
{this.renderHeader(prefixCls)}
|
||||||
|
|
|
@ -1,26 +1,27 @@
|
||||||
## API
|
## API
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 |
|
| 参数 | 说明 | 类型 | 默认值 | 版本 |
|
||||||
| --- | --- | --- | --- |
|
| --- | --- | --- | --- | --- |
|
||||||
| closable | 是否显示右上角的关闭按钮 | boolean | true |
|
| closable | 是否显示右上角的关闭按钮 | boolean | true | |
|
||||||
| destroyOnClose | 关闭时销毁 Drawer 里的子元素 | boolean | false |
|
| destroyOnClose | 关闭时销毁 Drawer 里的子元素 | boolean | false | |
|
||||||
| getContainer | 指定 Drawer 挂载的 HTML 节点 | HTMLElement \| `() => HTMLElement` \| Selectors | 'body' |
|
| getContainer | 指定 Drawer 挂载的 HTML 节点 | HTMLElement \| `() => HTMLElement` \| Selectors | 'body' | |
|
||||||
| maskClosable | 点击蒙层是否允许关闭 | boolean | true |
|
| maskClosable | 点击蒙层是否允许关闭 | boolean | true | |
|
||||||
| mask | 是否展示遮罩 | Boolean | true |
|
| mask | 是否展示遮罩 | Boolean | true | |
|
||||||
| maskStyle | 遮罩样式 | object | {} |
|
| maskStyle | 遮罩样式 | object | {} | |
|
||||||
| title | 标题 | string \| slot | - |
|
| title | 标题 | string \| slot | - | |
|
||||||
| visible | Drawer 是否可见 | boolean | - |
|
| visible | Drawer 是否可见 | boolean | - | |
|
||||||
| wrapClassName | 对话框外层容器的类名 | string | - |
|
| wrapClassName | 对话框外层容器的类名 | string | - | |
|
||||||
| wrapStyle | 对话框外层容器的`style` | object | - |
|
| wrapStyle | 可用于设置 Drawer 最外层容器的样式,和 `drawerStyle` 的区别是作用节点包括 `mask` | object | - | |
|
||||||
| bodyStyle | 可用于设置 Drawer 的样式,调整浮层位置等 | object | - |
|
| drawerStyle | 用于设置 Drawer 弹出层的样式 | object | - | 1.4.11 |
|
||||||
| width | 宽度 | string \| number | 256 |
|
| bodyStyle | 可用于设置 Drawer 内容部分的样式 | object | - | |
|
||||||
| height | 高度, 在 `placement` 为 `top` 或 `bottom` 时使用 | string \| number | 256 |
|
| width | 宽度 | string \| number | 256 | |
|
||||||
| zIndex | 设置 Drawer 的 `z-index` | Number | 1000 |
|
| height | 高度, 在 `placement` 为 `top` 或 `bottom` 时使用 | string \| number | 256 | |
|
||||||
| placement | 抽屉的方向 | 'top' \| 'right' \| 'bottom' \| 'left' | 'right' |
|
| zIndex | 设置 Drawer 的 `z-index` | Number | 1000 | |
|
||||||
| handle | 设置后抽屉直接挂载到 DOM 上,你可以通过该 handle 控制抽屉打开关闭 | VNode \| slot | - |
|
| placement | 抽屉的方向 | 'top' \| 'right' \| 'bottom' \| 'left' | 'right' | |
|
||||||
|
| handle | 设置后抽屉直接挂载到 DOM 上,你可以通过该 handle 控制抽屉打开关闭 | VNode \| slot | - | |
|
||||||
|
|
||||||
## 方法
|
## 方法
|
||||||
|
|
||||||
| 名称 | 描述 | 类型 | 默认值 |
|
| 名称 | 描述 | 类型 | 默认值 | 版本 |
|
||||||
| ----- | ------------------------------------ | ----------- | ------ |
|
| ----- | ------------------------------------ | ----------- | ------ | ---- |
|
||||||
| close | 点击遮罩层或右上角叉或取消按钮的回调 | function(e) | 无 |
|
| close | 点击遮罩层或右上角叉或取消按钮的回调 | function(e) | 无 | |
|
||||||
|
|
|
@ -67,11 +67,17 @@ export declare class Drawer extends AntdComponent {
|
||||||
wrapClassName: string;
|
wrapClassName: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The style of the container of the Drawer dialog.
|
* Style of wrapper element which **contains mask** compare to `drawerStyle`
|
||||||
* @type object
|
* @type object
|
||||||
*/
|
*/
|
||||||
wrapStyle: object;
|
wrapStyle: object;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Style of the popup layer element
|
||||||
|
* @type object
|
||||||
|
*/
|
||||||
|
drawerStyle: object;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Style of floating layer, typically used for adjusting its position.
|
* Style of floating layer, typically used for adjusting its position.
|
||||||
* @type object
|
* @type object
|
||||||
|
|
Loading…
Reference in New Issue