-
-
Notifications
You must be signed in to change notification settings - Fork 319
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
fix: use Rect for logic #906
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Caution Review failedThe pull request is closed. Walkthrough该PR对Picker组件的布局和状态管理进行了调整。样式上增加了面板布局的CSS类,组件内部则将原有单一数值的activeOffset和placement替换为包含多个信息的activeInfo元组,进而改进了Popup、RangePicker和RangeSelector中三角形的位置计算。与此同时,移除了部分无用的工具函数,并在测试中引入了resize事件的模拟,以确保组件响应正确。 Changes
Sequence Diagram(s)sequenceDiagram
participant RP as RangePicker
participant RS as RangeSelector
participant PP as Popup
participant UI as UI Renderer
RP->>RS: 初始化 activeInfo([0, 0, 0])
RS->>RS: 计算输入框边界信息
RS->>RP: 调用 onActiveInfo传递新的[左偏移, 右偏移, 宽度]
RP->>PP: 传递 activeInfo 属性
PP->>PP: 计算 arrowOffset基于 activeInfo
PP->>UI: 更新弹出框和三角形位置
Assessment against linked issues
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure. 🔧 ESLint
src/PickerInput/Popup/index.tsxOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /.eslintrc.js
src/PickerInput/RangePicker.tsxOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /.eslintrc.js
src/PickerInput/Selector/RangeSelector.tsxOops! Something went wrong! :( ESLint: 8.57.1 Error: Cannot read config file: /.eslintrc.js
📜 Recent review detailsConfiguration used: CodeRabbit UI ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (6)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #906 +/- ##
==========================================
+ Coverage 95.47% 98.67% +3.20%
==========================================
Files 64 64
Lines 2740 2648 -92
Branches 742 732 -10
==========================================
- Hits 2616 2613 -3
+ Misses 121 32 -89
Partials 3 3 ☔ View full report in Codecov by Sentry. |
fix ant-design/ant-design#51071
close #886
直接用
getBoundingClientRect
来做相对位置计算,以无视来自于 Placement 的各种偏移、翻转的干扰。过去 offset size 计算可以支持 scale 的场景,但是目前看对于多次翻转会过于复杂。目前也没有看到相关 issue,先不用关注缩放场景。Summary by CodeRabbit
样式
内部调整
测试