feat: Drawer support drawerRender (#49125)

* feat: Drawer support drawerRender

* feat: add test
This commit is contained in:
叶枫 2024-05-30 20:45:47 +08:00 committed by GitHub
parent b4a98273fb
commit a6bfb84993
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 1 deletions

View File

@ -400,4 +400,15 @@ describe('Drawer', () => {
expect(baseElement.querySelector('.custom-close')).not.toBeNull();
expect(baseElement.querySelector('*[aria-label="Close"]')).not.toBeNull();
});
it('drawerRender', () => {
const { container } = render(
<Drawer open getContainer={false} drawerRender={(dom) => <div id="test">{dom}</div>}>
Here is content of Drawer
</Drawer>,
);
triggerMotion();
expect(container.querySelector('#test')).toBeTruthy();
});
});

View File

@ -78,6 +78,7 @@ v5 use `rootClassName` & `rootStyle` to config wrapper style instead of `classNa
| width | Width of the Drawer dialog | string \| number | 378 | |
| zIndex | The `z-index` of the Drawer | number | 1000 | |
| onClose | Specify a callback that will be called when a user clicks mask, close button or Cancel button | function(e) | - | |
| drawerRender | Custom drawer content render | (node: ReactNode) => ReactNode | - | 5.19.0 |
## Semantic DOM

View File

@ -77,6 +77,7 @@ v5 使用 `rootClassName` 与 `rootStyle` 来配置最外层元素样式。原 v
| width | 宽度 | string \| number | 378 | |
| zIndex | 设置 Drawer 的 `z-index` | number | 1000 | |
| onClose | 点击遮罩层或左上角叉或取消按钮的回调 | function(e) | - | |
| drawerRender | 自定义渲染抽屉 | (node: ReactNode) => ReactNode | - | 5.19.0 |
## Semantic DOM

View File

@ -134,7 +134,7 @@
"rc-checkbox": "~3.3.0",
"rc-collapse": "~3.7.3",
"rc-dialog": "~9.4.0",
"rc-drawer": "~7.1.0",
"rc-drawer": "~7.2.0",
"rc-dropdown": "~4.2.0",
"rc-field-form": "~2.2.0",
"rc-image": "~7.8.0",