Navigation Menu

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

chore: improve Form.Item on Require judgment logic #41623

Merged

Conversation

Wxh16144
Copy link
Member

@Wxh16144 Wxh16144 commented Apr 4, 2023

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Workflow
  • Other (about what?)

🔗 Related issue link

fix #41621

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English improve Form.Item on Require judgment logic
🇨🇳 Chinese 改进 Form.Item 关于 Require 判断逻辑

☑️ Self-Check before Merge

⚠️ Please check all items below before requesting a reviewing. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

🤖 Generated by Copilot at c37f6f5

This pull request adds a new feature and fixes a bug for the form component. It enables the user to customize the required mark of the form item label with a new required prop, and ensures that the required mark is displayed correctly when the required prop is undefined. It also updates the test file components/form/__tests__/index.test.tsx to cover the new feature and the bug fix.

🔍 Walkthrough

🤖 Generated by Copilot at c37f6f5

  • Add a new prop required to the ItemHolder component to indicate whether the form item is required or not (link)
  • Pass the required prop from the ItemHolder component to the FormItemLabel component and use it to override the isRequired prop (link)
  • Remove the hard-coded 'required' string from the className of the form item wrapper and use the required prop instead (link)
  • Add a new test case to check that the form item label still shows the required mark when the required prop is undefined and the rules prop contains a required: true rule in components/form/__tests__/index.test.tsx (link)

@github-actions
Copy link
Contributor

github-actions bot commented Apr 4, 2023

@codecov
Copy link

codecov bot commented Apr 4, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (4299d77) 100.00% compared to head (c37f6f5) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #41623   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          614       614           
  Lines        10496     10497    +1     
  Branches      2873      2874    +1     
=========================================
+ Hits         10496     10497    +1     
Impacted Files Coverage Δ
components/form/FormItem/ItemHolder.tsx 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@zombieJ zombieJ merged commit ef8b824 into ant-design:master Apr 4, 2023
58 checks passed
RedJue pushed a commit to RedJue/ant-design that referenced this pull request Apr 25, 2023
* test: add case

* chore: improve `Form.Item` on Require judgment logic
RedJue pushed a commit to RedJue/ant-design that referenced this pull request Apr 25, 2023
* test: add case

* chore: improve `Form.Item` on Require judgment logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FormItem required 为 undefined 时会使 必选样式 丢失
2 participants