-
-
Notifications
You must be signed in to change notification settings - Fork 101
feat: add resizable drawer feature #527
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
base: antd-5.x
Are you sure you want to change the base?
Conversation
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing Touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
@QdabuliuQ is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
} | ||
|
||
export interface DrawerStyles { | ||
mask?: React.CSSProperties; | ||
wrapper?: React.CSSProperties; | ||
content?: React.CSSProperties; | ||
resizableLine?: React.CSSProperties; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onResize?: (size: number) => void; | ||
onResizeStart?: () => void; | ||
onResizeEnd?: () => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不确定是否需要一开始暴露这么多回调,看看大佬们怎么说~ 也可以说说你的想法
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是的嘞,我觉得有必要暴露出去,因为 antd/drawer 组件使用的时候需要监听到 start / end 事件,取消 / 恢复 transition 过渡 antd/drawer 宽度的样式,这样在拖拽的时候可以动态开启和关闭 transition 影响。
上面的问题都调整了,麻烦大佬们再看看~ |
// Add global mouse event listeners during drag | ||
document.addEventListener('mousemove', handleMouseMove); | ||
document.addEventListener('mouseup', handleMouseUp); | ||
document.body.style.cursor = isHorizontal ? 'col-resize' : 'row-resize'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为啥是 body,如果 dom 不在 body 上呢
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这里是鼠标按住resizable
组件的后进入isDragging
状态,就给 body 监听鼠标移动和抬起事件,计算 drawer 的宽度的呀;dom
不在 body
也是可以正常计算的哩
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get
辛苦了~ 感谢你的贡献,太感谢了。 |
#528 @thinkasany 新的 pr 合并到 master的~ |
参考一下 bot 的 cr 建议,有的好像是可以考虑的,然后明天帮你问问豆酱~ |
🤔 This is a ...
🔗 Related Issues
feat: ant-design/ant-design#54597
💡 Background and Solution
add resizable feature to Drawer component
add ResizableLine component to control the size of drawer
📝 Change Log