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(inputnumber): value 大于 max 图标应处于禁用态 #3107

Merged
merged 1 commit into from
Mar 21, 2025

Conversation

oasis-cloud
Copy link
Collaborator

@oasis-cloud oasis-cloud commented Mar 20, 2025

Summary by CodeRabbit

  • Bug Fixes
    • 调整了数字输入组件中加减按钮的禁用条件:当数值低于或等于最小值时,“减号”按钮会被禁用;当数值达到或超过最大值时,“加号”按钮会被禁用。这一改进确保组件操作更准确,防止用户超出预期范围。

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
Copy link

coderabbitai bot commented Mar 20, 2025

Walkthrough

该提交更新了 InputNumber 组件中减号和加号按钮的禁用条件。现当 shadowValue 小于或等于 min 时,减号按钮禁用;当 shadowValue 大于或等于 max 时,加号按钮禁用。此次修改仅调整了内部逻辑判断,并未变更导出或公共实体的声明。

Changes

文件 变更摘要
src/packages/.../inputnumber.taro.tsx
src/packages/.../inputnumber.tsx
修改了 InputNumber 组件中减号和加号按钮的禁用条件,由严格相等判断调整为使用小于等于和大于等于的包含性比较。

Sequence Diagram(s)

Loading
sequenceDiagram
    participant User as 用户
    participant Comp as InputNumber 组件

    User->>Comp: 点击减号按钮
    alt shadowValue <= min
        Comp->>Comp: 禁用减号按钮
    else
        Comp->>Comp: 执行减操作
    end

    User->>Comp: 点击加号按钮
    alt shadowValue >= max
        Comp->>Comp: 禁用加号按钮
    else
        Comp->>Comp: 执行加操作
    end

Possibly related PRs

Suggested reviewers

  • xiaoyatong
  • Alex-huxiyang

Poem

嗨,我是一只快乐的小兔子,
见证代码变更真奇妙 🐰。
减号与加号精准把控,
数值边界再也不摇摆。
胡萝卜般的代码,轻松又美好!
快来一起跳跃在逻辑的花园中!


📜 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 2a74f0f and b2d67ea.

📒 Files selected for processing (2)
  • src/packages/inputnumber/inputnumber.taro.tsx (2 hunks)
  • src/packages/inputnumber/inputnumber.tsx (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: test
🔇 Additional comments (4)
src/packages/inputnumber/inputnumber.taro.tsx (2)

191-192: 改进了减号按钮的禁用条件逻辑

此处将减号按钮的禁用条件从之前的等于最小值改为小于等于最小值,使得当数值低于或等于最小值时,减号按钮都会处于禁用状态,这样可以防止用户继续减少数值至小于最小值的情况。


218-219: 改进了加号按钮的禁用条件逻辑

此处将加号按钮的禁用条件从之前的等于最大值改为大于等于最大值,解决了值大于最大值时加号按钮仍然可点击的问题。这样可以确保当数值达到或超过最大值时,加号按钮会处于禁用状态,防止用户继续增加数值。

src/packages/inputnumber/inputnumber.tsx (2)

188-189: 改进了减号按钮的禁用条件逻辑

此处将减号按钮的禁用条件从之前的等于最小值改为小于等于最小值,使得当数值低于或等于最小值时,减号按钮都会处于禁用状态,这样可以防止用户继续减少数值至小于最小值的情况。


212-213: 改进了加号按钮的禁用条件逻辑

此处将加号按钮的禁用条件从之前的等于最大值改为大于等于最大值,符合PR标题中描述的"value 大于 max 图标应处于禁用态"的需求。这样可以确保当数值达到或超过最大值时,加号按钮会处于禁用状态,防止用户继续增加数值。

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • 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 generate docstrings to generate docstrings for this 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.

Sorry, something went wrong.

@github-actions github-actions bot added 3.x Target branch 3.x action:review This PR needs more reviews (less than 2 approvals) and removed 3.x Target branch 3.x labels Mar 20, 2025
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.49%. Comparing base (2a74f0f) to head (b2d67ea).
Report is 1 commits behind head on feat_v3.x.

Additional details and impacted files
@@            Coverage Diff             @@
##           feat_v3.x    #3107   +/-   ##
==========================================
  Coverage      86.49%   86.49%           
==========================================
  Files            280      280           
  Lines          18492    18494    +2     
  Branches        2774     2775    +1     
==========================================
+ Hits           15994    15996    +2     
  Misses          2493     2493           
  Partials           5        5           

☔ 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.

@irisSong irisSong merged commit 2cf72cc into jdf2e:feat_v3.x Mar 21, 2025
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action:review This PR needs more reviews (less than 2 approvals) size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants