feat(module:input): input-wrapper supports custom count logic#9645
feat(module:input): input-wrapper supports custom count logic#9645iaosee wants to merge 8 commits intoNG-ZORRO:masterfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9645 +/- ##
==========================================
- Coverage 90.20% 90.08% -0.13%
==========================================
Files 573 574 +1
Lines 23701 23754 +53
Branches 4787 4833 +46
==========================================
+ Hits 21380 21398 +18
- Misses 1503 1523 +20
- Partials 818 833 +15 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR adds custom count logic support to the nz-input-wrapper component, implementing the AntD input custom count logic feature. The feature allows developers to display character counts with customizable counting strategies, maximum limits, and automatic value formatting when limits are exceeded.
Changes:
- Added four new inputs to
nz-input-wrapper:nzShowCount,nzCountMax,nzCountStrategy, andnzExceedFormatterfor flexible character counting - Implemented reactive count display with out-of-range visual feedback using signals and effects
- Added comprehensive test coverage for various count scenarios including emoji handling and custom formatting
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| components/input/input-wrapper.component.ts | Core implementation: added count-related inputs, signals for reactive state, effect for count updates, and template integration for count display |
| components/input/style/index.less | Added CSS styling for out-of-range state (.ant-input-out-of-range) that applies error color to input and count suffix |
| components/input/input-wrapper.component.spec.ts | Added comprehensive test suite covering show/hide count, basic counting, max limit enforcement, and custom strategy/formatter scenarios |
| components/input/doc/index.en-US.md | Updated English API documentation with the four new input properties and their descriptions |
| components/input/doc/index.zh-CN.md | Updated Chinese API documentation with the four new input properties and their descriptions |
| components/input/demo/advance-count.ts | New demo component showcasing various count configurations including emoji handling, exceed formatting, and integration with password/search inputs |
| components/input/demo/advance-count.md | Documentation for the new demo explaining the custom count feature and its use cases |
Co-authored-by: Copilot <[email protected]>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable feature for custom input counting in nz-input-wrapper. The implementation is well-structured, including documentation and a demonstration. However, I've identified a few areas for improvement in the core logic that could prevent potential runtime errors and improve code consistency. Additionally, there's an opportunity to streamline the test suite by removing a redundant test case. My feedback includes specific suggestions to address these points.
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
input-wrapper supports custom count logic.
implements feature AntD input custom count logic.
Does this PR introduce a breaking change?
Other information