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(FormItem): add name as default variables.label value #30179

Merged
merged 2 commits into from
Jun 30, 2021

Conversation

jameslahm
Copy link
Contributor

@jameslahm jameslahm commented Apr 16, 2021

[中文版模板 / 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
  • Other (about what?)

🔗 Related issue link

Fix #30146. When label is not given, ${label} will be replaced by undefined. I think we could add name as a default variables.label value.

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English add name as a default label value in validationMessages.
🇨🇳 Chinese 增加name作为验证消息label的默认值

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • 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

@github-actions
Copy link
Contributor

github-actions bot commented Apr 16, 2021

@codecov
Copy link

codecov bot commented Apr 16, 2021

Codecov Report

Merging #30179 (d2b1e82) into master (aa9fac4) will not change coverage.
The diff coverage is 100.00%.

❗ Current head d2b1e82 differs from pull request most recent head 6604491. Consider uploading reports for the commit 6604491 to get more accurate results
Impacted file tree graph

@@            Coverage Diff            @@
##            master    #30179   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          397       397           
  Lines         7519      7563   +44     
  Branches      2105      2128   +23     
=========================================
+ Hits          7519      7563   +44     
Impacted Files Coverage Δ
components/_util/hooks/useFlexGapSupport.ts 100.00% <ø> (ø)
components/config-provider/index.tsx 100.00% <ø> (ø)
components/date-picker/locale/fi_FI.tsx 100.00% <ø> (ø)
components/date-picker/locale/hi_IN.tsx 100.00% <ø> (ø)
components/date-picker/locale/nl_BE.tsx 100.00% <ø> (ø)
components/date-picker/locale/nl_NL.tsx 100.00% <ø> (ø)
components/date-picker/locale/sr_RS.tsx 100.00% <ø> (ø)
components/grid/row.tsx 100.00% <ø> (ø)
components/index.tsx 100.00% <ø> (ø)
components/layout/Sider.tsx 100.00% <ø> (ø)
... and 64 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update aa9fac4...6604491. Read the comment docs.

@@ -265,6 +265,8 @@ function FormItem<Values = any>(props: FormItemProps<Values>): React.ReactElemen
let variables: Record<string, string> = {};
if (typeof label === 'string') {
variables.label = label;
} else if (name) {
variables.label = String(name);
Copy link
Member

Choose a reason for hiding this comment

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

Could you help to add a test case about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, I will add the test case as soon as possible ~

@jameslahm jameslahm requested a review from zombieJ June 17, 2021 02:01
@afc163 afc163 merged commit 7a10ed1 into ant-design:master Jun 30, 2021
yingpengsha pushed a commit to yingpengsha/ant-design that referenced this pull request Jul 2, 2021
…30179)

* fix(FormItem): add name as default variables.label value

* test(Form.Item): add name as default test
@zombieJ zombieJ mentioned this pull request Jul 12, 2021
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants