-
-
Notifications
You must be signed in to change notification settings - Fork 365
feat(Dropdown): add OnClick event callback #5319
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
Conversation
Reviewer's Guide by SourceryThis PR adds support for OnClick event callbacks in the Dropdown component. It introduces new parameters and associated event handling logic in the component, updates the markup to integrate these changes, and modifies sample usage and documentation to reflect the new functionality. Sequence diagram for Dropdown OnClick event callbacksequenceDiagram
actor User
participant Dropdown
note over Dropdown: On button click triggers OnClickButton()
User->>Dropdown: Clicks on dropdown button
Dropdown->>Dropdown: if (OnClickWithoutRender != null)
alt OnClickWithoutRender exists
Dropdown->>Dropdown: await OnClickWithoutRender()
end
Dropdown->>Dropdown: if (OnClick.HasDelegate)
alt OnClick delegate present
Dropdown->>Dropdown: await OnClick.InvokeAsync()
end
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
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.
Hey @ArgoZhang - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider forwarding the MouseEventArgs parameter to OnClick.InvokeAsync so that event handlers can access click details.
- Review if invoking both OnClickWithoutRender and OnClick in sequence is intended and document the order if necessary.
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
|
|
||
| private string? ButtonText => IsFixedButtonText ? FixedButtonText : SelectedItem?.Text; | ||
|
|
||
| private async Task OnClickButton() |
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.
issue: Event callback handler signature may be missing MouseEventArgs parameter.
Since the OnClick parameter is of type EventCallback, consider updating OnClickButton to accept a MouseEventArgs parameter (e.g. OnClickButton(MouseEventArgs e)) and passing it to OnClick.InvokeAsync(e). This ensures that any event data provided by the underlying click event is not lost.
add OnClick event callback
Summary of the changes (Less than 80 chars)
简单描述你更改了什么, 不超过80个字符;如果有关联 Issue 请在下方填写相关编号
Description
fixes #5321
Regression?
[If yes, specify the version the behavior has regressed from]
[是否影响老版本]
Risk
[Justify the selection above]
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add
OnClickandOnClickWithoutRenderevents to theDropdowncomponent.New Features:
OnClickevent callback to theDropdowncomponent to allow custom logic to be executed when the dropdown button is clicked.OnClickWithoutRenderevent callback to theDropdowncomponent. This event is useful for scenarios where re-rendering the parent component is not desired after the click action.