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

feat(module: core) Allow controls to be used in default EditForm #2138

Merged
merged 2 commits into from
Dec 10, 2021

Conversation

knight1219
Copy link
Contributor

🤔 This is a ...

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

🔗 Related issue link

Issue was detailed on Discord

💡 Background and solution

When trying to convert my app to use AntDesign, none of the validation styling worked. Doing some research I found that none of the controls could be used as a drop in replacement for default Blazor Controls. No validation was getting fired as the EditContext was fully able to cascade down. This in addition to the validation styling being part of the FormItem was a problem for me.

I have updated the FormItem to be able to be used in the default EditForm and updated the AntInputComponentBase to be able to cascade the EditContext. Added a demo of this in the Form area of the documents.

📝 Changelog

Language Changelog
🇺🇸 English
🇨🇳 Chinese

☑️ 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
  • Changelog is provided or not needed

@github-actions
Copy link

github-actions bot commented Nov 28, 2021

@codecov
Copy link

codecov bot commented Nov 28, 2021

Codecov Report

Merging #2138 (5afc51f) into master (8f89deb) will increase coverage by 2.02%.
The diff coverage is 46.51%.

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

@@            Coverage Diff             @@
##           master    #2138      +/-   ##
==========================================
+ Coverage   27.86%   29.89%   +2.02%     
==========================================
  Files         492      515      +23     
  Lines       32544    24777    -7767     
  Branches        0      242     +242     
==========================================
- Hits         9070     7407    -1663     
+ Misses      23474    17334    -6140     
- Partials        0       36      +36     
Impacted Files Coverage Δ
components/date-picker/RangePicker.razor.cs 0.00% <0.00%> (ø)
components/input/Input.cs 67.61% <ø> (+4.64%) ⬆️
components/tree-select/TreeSelect.razor.cs 0.00% <0.00%> (ø)
components/core/Base/AntInputComponentBase.cs 61.46% <37.03%> (+5.17%) ⬆️
components/form/FormItem.razor.cs 42.38% <72.72%> (+4.58%) ⬆️
components/select/Select.razor.cs 52.80% <100.00%> (+2.23%) ⬆️
components/select/SelectBase.cs 71.11% <100.00%> (+5.49%) ⬆️
components/core/Helpers/MemberPath/PathNode.cs 46.15% <0.00%> (-8.85%) ⬇️
components/core/Reflection/TypeDefined.cs 77.77% <0.00%> (-7.94%) ⬇️
components/input/InputGroup.razor.cs 87.50% <0.00%> (-6.95%) ⬇️
... and 430 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 35ae6c6...882e780. Read the comment docs.

@anranruye
Copy link
Member

Why don't you use AntDesign.Form instead of EditForm? there's an EditForm inside AntDesign.Form, so default blazor components should be able to work with ant-design components together in a AntDesign.Form.

@knight1219
Copy link
Contributor Author

knight1219 commented Nov 29, 2021 via email

@ElderJames
Copy link
Member

You can setup your custom validations using <Validator>.

https://antblazor.com/en-US/components/form#components-form-demo-customized-form-validator

Copy link
Member

@ElderJames ElderJames left a comment

Choose a reason for hiding this comment

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

LGTM

@ElderJames
Copy link
Member

Hi @knight1219 ,
When we released 0.10.3 we found that the changes in this PR would make Select not work when in Form. So we have revert this PR.
Looking forward to merging it in again when you get it fixed.

@knight1219
Copy link
Contributor Author

I'm on vacation till Monday but I will take a look when I get back. Is there an issue this showed up in?

@ElderJames
Copy link
Member

Yes, #2191 #2192

ElderJames pushed a commit that referenced this pull request Apr 23, 2022
)

* refactoring EditContext to be injected properly by both AndDesign.Form and EditForm.

* Allowing FormItem to be used in default EditF
ElderJames added a commit that referenced this pull request Apr 23, 2022
ElderJames pushed a commit that referenced this pull request Apr 30, 2022
)

* refactoring EditContext to be injected properly by both AndDesign.Form and EditForm.

* Allowing FormItem to be used in default EditF
ElderJames added a commit that referenced this pull request Apr 30, 2022
ElderJames pushed a commit that referenced this pull request Sep 6, 2022
)

* refactoring EditContext to be injected properly by both AndDesign.Form and EditForm.

* Allowing FormItem to be used in default EditF
ElderJames added a commit that referenced this pull request Sep 6, 2022
@ElderJames
Copy link
Member

Hello @knight1219 , would you fixed this?

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.

None yet

3 participants