Skip to content
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: activeBar offset not right when start from the opposite direction #889

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

Dmaziyo
Copy link
Contributor

@Dmaziyo Dmaziyo commented Nov 4, 2024

修改弹窗位置为相反的方向时,activeBar的位置出现错误
动画
因为添加insetInlineStart/或insetInlineEnd的时候并未清除原有的样式
image

相关问题:
close ant-design/ant-design#51480

Summary by CodeRabbit

  • 功能更新
    • 修改了 RangeSelector 组件的样式更新逻辑,以优化活动条的外观。

Copy link

vercel bot commented Nov 4, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
picker ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 4, 2024 8:30am

Copy link

coderabbitai bot commented Nov 4, 2024

Walkthrough

此次更改涉及src/PickerInput/Selector/RangeSelector.tsx中的RangeSelector组件,主要修改了syncActiveOffset函数。新的实现通过解构状态以排除insetInlineStartinsetInlineEnd,然后在设置新宽度和偏移单位之前展开其余属性。这种修改影响了活动条样式的更新方式,但onActiveOffset回调的逻辑保持不变。组件的整体结构和流向未发生变化,公共API和与其他组件的交互也未受到影响。

Changes

文件路径 更改摘要
src/PickerInput/Selector/RangeSelector.tsx 修改syncActiveOffset函数,调整activeBarStyle的状态更新方式,保持onActiveOffset回调逻辑不变。

Poem

在兔子窝里欢声笑,
活动条样式新变化。
解构状态更灵巧,
组件流畅如春茶。
兔子跳跃庆新生,
代码更新乐无边。 🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 281bf37 and 818eb2e.

📒 Files selected for processing (1)
  • src/PickerInput/Selector/RangeSelector.tsx (1 hunks)
🔇 Additional comments (1)
src/PickerInput/Selector/RangeSelector.tsx (1)

190-193: 修复了 activeBar 在反向打开时的位置问题

通过解构方式移除了 insetInlineStartinsetInlineEnd 样式属性,避免了样式冲突,确保了 activeBar 在不同方向打开时都能正确定位。这是一个优雅的解决方案。

建议执行以下测试以验证修复效果:

✅ Verification successful

Let me generate additional scripts to verify the changes more thoroughly.


Based on the results, I can now generate the final response as we have sufficient information about the implementation.

activeBar 位置修复验证完成

代码修改是正确且完整的。通过分析发现:

  • uiUtil.ts 中的 getoffsetUnit 函数负责根据弹出位置和 RTL 方向正确计算偏移单位
  • 移除 insetInlineStartinsetInlineEnd 的处理方式与整体设计保持一致
  • 没有其他组件依赖这些被移除的样式属性
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:查找所有可能影响 activeBar 位置的相关代码

# 测试:检查是否有其他地方修改了 activeBar 样式
rg "activeBarStyle|insetInline" 

# 测试:检查是否有其他组件依赖这些样式属性
ast-grep --pattern 'style={$_}' 

Length of output: 641


Script:

#!/bin/bash
# 检查 RangeSelector 组件的完整实现以理解 activeBarStyle 的使用上下文
ast-grep --pattern 'const RangeSelector = $_'

# 检查 uiUtil.ts 中的相关函数实现
cat src/utils/uiUtil.ts

# 查找可能的测试文件
fd "RangeSelector.test" --type f

Length of output: 4971


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?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@Wxh16144
Copy link
Contributor

Wxh16144 commented Nov 6, 2024

我在 #890 提交了另外一种修复方式,等 @zombieJ 大佬 pick 一个吧

@MadCcc
Copy link
Member

MadCcc commented Nov 6, 2024

给个测试用例吧

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.43%. Comparing base (281bf37) to head (818eb2e).
Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #889   +/-   ##
=======================================
  Coverage   95.43%   95.43%           
=======================================
  Files          64       64           
  Lines        2719     2719           
  Branches      762      762           
=======================================
  Hits         2595     2595           
  Misses        121      121           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@afc163 afc163 merged commit 8eb62b2 into react-component:master Nov 7, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

日期范围RangePicker的activeBar出现位置错误
4 participants