Skip to content

Conversation

@meet-student
Copy link
Contributor

@meet-student meet-student commented Jul 23, 2025

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ⌨️ Accessibility improvement
  • ❓ Other (about what?)

🔗 Related Issues

💡 Background and Solution

  • The specific problem to be addressed.
  • List the final API implementation and usage if needed.
  • If there are UI/interaction changes, consider providing screenshots or GIFs.

📝 Change Log

Language Changelog
🇺🇸 English add previewValue option
🇨🇳 Chinese add previewValue option

Summary by CodeRabbit

  • 新功能
    • Picker/RangePicker 新增 previewValue 属性(默认 "hover",支持 false),可控制悬停时是否临时预览输入值,支持关闭悬停预览。
  • 文档
    • README 和示例更新,新增多处“PreviewValue is false”示例(basic、range、time),并修正表格格式。
  • 测试
    • 新增日期与时间用例,验证 previewValue=false 时悬停不改变输入值。
@vercel
Copy link

vercel bot commented Jul 23, 2025

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

Project Deployment Preview Comments Updated (UTC)
picker Ready Preview Comment Aug 13, 2025 3:30am
@meet-student meet-student marked this pull request as draft July 23, 2025 14:42
@meet-student meet-student changed the title feat: add showPreviewValue option [WIP]feat: add showPreviewValue option Jul 23, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jul 23, 2025

Walkthrough

为 Picker/RangePicker 新增可选属性 previewValue('hover' 或 false,默认 'hover'),用以控制悬浮时是否预览输入值。更新了类型与默认填充逻辑、组件悬浮处理分支、文档与示例,并添加对应测试用例。

Changes

Cohort / File(s) Summary
组件逻辑:攧预览开关
src/PickerInput/SinglePicker.tsx, src/PickerInput/RangePicker.tsx
新增 prop previewValue;将 onPresetHover/onPanelHover 的悬浮状态更新改为通过 onSetHover,并仅在允许时更新内部 hover 状态(依据 previewValue)。
类型与默认值填充
src/interface.tsx, src/PickerInput/hooks/useFilledProps.ts
新增类型 PreviewValueType = 'hover';在 SharedPickerProps 中添加 `previewValue?: false
文档
README.md
在 Picker/RangePicker API 中新增 `previewValue: false
示例
docs/examples/*
.../basic.tsx, .../range.tsx, .../time.tsx
新增“PreviewValue is false”示例,展示 previewValue={false} 的效果;time 示例作一处语法符号修正。
测试
tests/range.spec.tsx, tests/time.spec.tsx
新增用例验证 previewValue={false} 时悬浮不改变输入预览值;time 测试添加 dayjs 引入并覆盖小时/分/秒/毫秒/上下午悬浮场景。

Sequence Diagram(s)

sequenceDiagram participant U as 用户 participant P as Picker/RangePicker participant S as 内部状态 U->>P: 悬浮单元格或预设 P->>P: 检查 previewValue alt previewValue == 'hover' P->>S: 更新 internal hover value S-->>P: 返回预览值 P-->>U: 输入框显示预览 else previewValue == false P-->>U: 忽略悬浮(不预览) end 
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~18 minutes

Assessment against linked issues

Objective Addressed Explanation
提供可禁用悬浮预览的能力(#54405)

Suggested reviewers

  • zombieJ
  • afc163

Poem

小兔悄看光标游,
悬浮若不愿入忧。
设为 hover 即映现,
若为 false 则归旧。
轻点收起不扰心。 🐰


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 515b51c and cf7b088.

📒 Files selected for processing (2)
  • src/PickerInput/RangePicker.tsx (3 hunks)
  • src/PickerInput/SinglePicker.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/PickerInput/SinglePicker.tsx
  • src/PickerInput/RangePicker.tsx
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ 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.
    • 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.
  • 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 the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

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

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • 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.
@meet-student meet-student changed the title [WIP]feat: add showPreviewValue option feat: add showPreviewValue option Jul 23, 2025
@meet-student meet-student marked this pull request as ready for review July 23, 2025 15:26
@codecov
Copy link

codecov bot commented Jul 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.80%. Comparing base (95da35c) to head (a8a18ff).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@ Coverage Diff @@ ## master #934 +/- ## ======================================= Coverage 98.80% 98.80% ======================================= Files 65 65 Lines 2669 2676 +7 Branches 742 745 +3 ======================================= + Hits 2637 2644 +7  Misses 29 29 Partials 3 3 

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
// ======================== Panel =========================
const onPanelHover = (date: DateType | null) => {
setInternalHoverValue(date);
if (showPreviewValue) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showHoverValue 如何?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

showHoverValue 如何?

类 Select 组件之后也可以支持一下这个功能

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@meet-student meet-student changed the title feat: add showPreviewValue option feat: add showHoverValue option Jul 24, 2025
@zombieJ
Copy link
Member

zombieJ commented Jul 30, 2025

突然想到,是否可以 previewValue="hover"?这样以后我们要拓展自定义功能还能:

previewValue={(info: { date }) => xxxx}
@meet-student meet-student changed the title feat: add showHoverValue option feat: add previewValue option Jul 31, 2025
@meet-student
Copy link
Contributor Author

meet-student commented Aug 12, 2025

@afc163 都已修改

@meet-student meet-student requested a review from afc163 August 12, 2025 16:01
@zombieJ
Copy link
Member

zombieJ commented Sep 9, 2025

优雅👍🏻

@zombieJ zombieJ merged commit 1e104e6 into react-component:master Sep 9, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants