fix: Form add change & reset callback#325
Merged
Merged
Conversation
Evergcj
commented
May 15, 2025
Collaborator
- fix form reset
- add onChange event for user operation
- fix radiogroup can not be reset in form
…rco-design-mobile into fix-form-reset-xzq
…om/arco-design/arco-design-mobile into feat-form-add-onChange-event-reset
…om/arco-design/arco-design-mobile into feat-form-add-onChange-event-reset
TinaPeach
reviewed
May 16, 2025
TinaPeach
reviewed
May 16, 2025
TinaPeach
reviewed
May 16, 2025
TinaPeach
reviewed
May 16, 2025
There was a problem hiding this comment.
Pull Request Overview
This PR addresses three key issues: it fixes the form reset behavior (including for radio groups), adds an onChange event for user interactions, and updates demo/test snapshots accordingly.
- Updates RadioGroup props to support resetting with null values.
- Enhances the form API with new initial value and field value management functions.
- Adjusts snapshot tests and demo examples to incorporate the new “single-line” style and event handlers.
Reviewed Changes
Copilot reviewed 18 out of 19 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/arcodesign/components/radio/type.ts | Updated RadioGroupProps to allow value to be null. |
| packages/arcodesign/components/radio/group.tsx | Adjusted state and value formatting for radio groups reset. |
| packages/arcodesign/components/input/index.tsx | Modified input type string to include “single-line” suffix. |
| packages/arcodesign/components/input/test/snapshots/index.spec.js.snap | Updated snapshots to reflect the new “single-line” class styling. |
| packages/arcodesign/components/form/utils.ts | Added deepClone and a default value function for form components. |
| packages/arcodesign/components/form/useForm.ts | Introduced new internal methods for setting and getting values. |
| packages/arcodesign/components/form/type.ts | Updated type definitions for form internals and callbacks. |
| packages/arcodesign/components/form/style/index.less | Revised LESS styles to apply “single-line” styles correctly. |
| packages/arcodesign/components/form/linked-container.tsx | Made ts optional in the linked container component. |
| packages/arcodesign/components/form/index.tsx | Passed the onChange prop through to the form instance. |
| packages/arcodesign/components/form/form-item.tsx | Refactored form item internal interactions and event triggers. |
| packages/arcodesign/components/form/demo/use-form.md | Added reset button example in demo. |
| packages/arcodesign/components/form/demo/index.md | Included onChange examples and updated initial values in demo. |
| packages/arcodesign/components/form/demo/custom-item.md | Provided a custom form item demo utilizing the updated form API. |
| package.json | Added a new dependency for lodash.clonedeepwith. |
Files not reviewed (1)
- packages/common-widgets/package-lock.json: Language not supported
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #325 +/- ##
==========================================
- Coverage 90.11% 89.84% -0.28%
==========================================
Files 141 141
Lines 8257 8475 +218
Branches 3389 3471 +82
==========================================
+ Hits 7441 7614 +173
- Misses 792 834 +42
- Partials 24 27 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
✨ PR Preview Link: https://preview-325-arco-design-mobile.surge.sh |
added 2 commits
June 5, 2025 19:47
Form add change & reset callback
TinaPeach
approved these changes
Jun 6, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.