-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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(module:textarea): fix style string format and auto-size issues #2001
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2001 +/- ##
==========================================
+ Coverage 27.57% 29.60% +2.03%
==========================================
Files 489 512 +23
Lines 32243 24612 -7631
Branches 0 240 +240
==========================================
- Hits 8890 7287 -1603
+ Misses 23353 17289 -6064
- Partials 0 36 +36
Continue to review full report at Codecov.
|
What happened here? It looked like a legitimate fix. You found some more issues with this? |
@anddrzejb No, there is no more issue. I just wrongly made the changes on my default branch but not a new branch. |
|
||
protected override async Task OnAfterRenderAsync(bool firstRender) | ||
{ | ||
await base.OnAfterRenderAsync(firstRender); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to call JS after firstRender.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
js is called in OnFirstAfterRenderAsync method.
Co-authored-by: James Yeung <shunjiey@hotmail.com>
components/input/TextArea.razor
Outdated
@@ -5,7 +5,7 @@ | |||
Dictionary<string, object> attributes = | |||
new Dictionary<string, object>() | |||
{ | |||
{ "onchange", CallbackFactory.Create(this, OnChangeAsync) }, | |||
{ "onchange", EventUtil.AsNonRenderingEventHandler<ChangeEventArgs>(e => OnChangeAsync(e)) }, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry, I might not have been clear enough...to avoid unnecessary re-renderings, you actually have to change all of them:
{ "onchange", EventUtil.AsNonRenderingEventHandler<ChangeEventArgs>(e => OnChangeAsync(e)) },
{ "onblur", EventUtil.AsNonRenderingEventHandler<FocusEventArgs>(e => OnBlurAsync(e)) },
{ "oninput", EventUtil.AsNonRenderingEventHandler<ChangeEventArgs>(e => OnInputAsync(e)) },
{ "onkeypress", EventUtil.AsNonRenderingEventHandler<KeyboardEventArgs>(e => OnKeyPressAsync(e)) },
{ "onkeyup", EventUtil.AsNonRenderingEventHandler<KeyboardEventArgs>(e => OnKeyUpAsync(e)) },
{ "onkeydown", EventUtil.AsNonRenderingEventHandler<KeyboardEventArgs>(e => OnkeyDownAsync(e)) },
{ "onfocus", EventUtil.AsNonRenderingEventHandler<FocusEventArgs>(e => OnFocusAsync(e)) },
You can just copy-paste, this is what I was using in my tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is something wrong with the no value-binding scenario. So I had to add the event callbacks again.
With event callbacks:
With NonRenderingEventHandlers:
razor code:
<TextArea Placeholder="Autosize height based on content lines" AutoSize="true" />
I think we can do more reasearch later and apply this change in another pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Some tests was failed. |
From the look of it, the tests:
should probably be removed or moved to ts tests, since all these are testing is now done in js.
|
…2001) * fix(module:textarea): fix style string format * seprate inner and outer style * fix AutoSize * fix custom style * Update site/AntDesign.Docs/Demos/Components/Input/demo/Area.md Co-authored-by: James Yeung <shunjiey@hotmail.com> * Move SetStyle to styleHelper * Update TextArea.razor * Update TextArea.cs * fix unit test Co-authored-by: James Yeung <shunjiey@hotmail.com>
…2001) * fix(module:textarea): fix style string format * seprate inner and outer style * fix AutoSize * fix custom style * Update site/AntDesign.Docs/Demos/Components/Input/demo/Area.md Co-authored-by: James Yeung <shunjiey@hotmail.com> * Move SetStyle to styleHelper * Update TextArea.razor * Update TextArea.cs * fix unit test Co-authored-by: James Yeung <shunjiey@hotmail.com>
…2001) * fix(module:textarea): fix style string format * seprate inner and outer style * fix AutoSize * fix custom style * Update site/AntDesign.Docs/Demos/Components/Input/demo/Area.md Co-authored-by: James Yeung <shunjiey@hotmail.com> * Move SetStyle to styleHelper * Update TextArea.razor * Update TextArea.cs * fix unit test Co-authored-by: James Yeung <shunjiey@hotmail.com>
🤔 This is a ...
🔗 Related issue link
Fixes #1997
Fixes #1998
💡 Background and solution
AutoSize doesn't work when:
📝 Changelog
☑️ Self Check before Merge