Skip to content

feat(module:input-number): accepted numbers with commas - #9256

Merged
Laffery merged 1 commit into
NG-ZORRO:masterfrom
HyperLife1119:feat/input-number-with-commas
Jul 17, 2025
Merged

Laffery merged 1 commit into
NG-ZORRO:masterfrom
HyperLife1119:feat/input-number-with-commas

Conversation

@HyperLife1119

@HyperLife1119 HyperLife1119 commented Jun 27, 2025 •

Copy link
Copy Markdown
Collaborator

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Application (the showcase website) / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

input-number should accept numbers with commas, consistent with antd's behavior.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables the input-number component to correctly handle numbers with commas, aligning its behavior with ANTD.

  • Updated the defaultParser function to remove commas before parsing a number.
  • Added tests to verify that comma-separated numerical inputs are parsed correctly.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
components/input-number/input-number.component.ts Updated parser function to strip commas from inputs.
components/input-number/input-number.component.spec.ts Added tests to cover comma-separated number inputs.
Comments suppressed due to low confidence (1)

components/input-number/input-number.component.ts:534

  • Consider updating or adding a comment for the defaultParser function to document the new behavior of removing commas from the input string.
  return +value.trim().replace(/,/g, '').replace(/。/g, '.');

@codecov

codecov Bot commented Jun 27, 2025 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.07%. Comparing base (bf2b33b) to head (69ab3e1).
Report is 19 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #9256   +/-   ##
=======================================
  Coverage   92.06%   92.07%           
=======================================
  Files         560      561    +1     
  Lines       19621    19610   -11     
  Branches     3098     3102    +4     
=======================================
- Hits        18064    18055    -9     
+ Misses       1218     1215    -3     
- Partials      339      340    +1     

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

Comment thread components/input-number/input-number.component.spec.ts
@HyperLife1119
HyperLife1119 marked this pull request as draft June 30, 2025 01:21
@HyperLife1119
HyperLife1119 force-pushed the feat/input-number-with-commas branch 2 times, most recently from 55147de to 44caf16 Compare July 7, 2025 03:31
@HyperLife1119
HyperLife1119 force-pushed the feat/input-number-with-commas branch from 44caf16 to 69ab3e1 Compare July 7, 2025 03:32
@HyperLife1119
HyperLife1119 marked this pull request as ready for review July 7, 2025 03:44
@HyperLife1119
HyperLife1119 requested a review from Laffery July 7, 2025 03:45

@Laffery Laffery left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants