-
-
Notifications
You must be signed in to change notification settings - Fork 364
feat(Select): add ShowSwal parameter #6053
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
Co-Authored-By: AApuci <[email protected]>
Reviewer's GuideAdds a configurable ShowSwal flag to the Select component to control confirmation popups, updates sample attributes and localization entries for the new parameter, and bumps the project version. Sequence diagram for the OnClickItem interaction with ShowSwalsequenceDiagram
participant User
participant SelectComponent as Select<TValue>
participant SwalService
User->>SelectComponent: Clicks on an item
SelectComponent->>SelectComponent: OnClickItem(item)
alt OnBeforeSelectedItemChange is not null
SelectComponent->>+OnBeforeSelectedItemChange: Call(item)
OnBeforeSelectedItemChange-->>-SelectComponent: Return confirmationRequired (true/false)
alt confirmationRequired is true AND ShowSwal is true
SelectComponent->>+SwalService: ShowModal(option)
SwalService-->>-SelectComponent: Return userConfirmed (true/false)
alt userConfirmed is true
SelectComponent->>SelectComponent: Update SelectedValue
SelectComponent->>SelectComponent: Invoke OnSelectedItemChanged
end
else confirmationRequired is true AND ShowSwal is false
SelectComponent->>SelectComponent: Update SelectedValue
SelectComponent->>SelectComponent: Invoke OnSelectedItemChanged
else confirmationRequired is false
SelectComponent->>SelectComponent: Do nothing further
end
else OnBeforeSelectedItemChange is null
SelectComponent->>SelectComponent: Update SelectedValue
SelectComponent->>SelectComponent: Invoke OnSelectedItemChanged
end
Updated class diagram for the Select componentclassDiagram
class Select_TValue_ {
+bool ShowSwal
+Func<SelectedItem, Task<bool>> OnBeforeSelectedItemChange
+Task OnClickItem(SelectedItem item)
}
File-Level Changes
Assessment against 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.
Pull Request Overview
This PR introduces a new ShowSwal toggle for the Select<TValue> component, letting consumers disable the Swal confirmation popup, and updates related localization, samples, and versioning.
- Added
ShowSwalparameter and adjusted theOnClickItemlogic. - Added
SelectsShowSwalentries in both en-US and zh-CN locales. - Updated the sample attribute list and bumped the project version.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/BootstrapBlazor/Components/Select/Select.razor.cs | Added ShowSwal parameter and updated click logic |
| src/BootstrapBlazor.Server/Locales/zh-CN.json | Added Chinese translation for SelectsShowSwal |
| src/BootstrapBlazor.Server/Locales/en-US.json | Added English string for SelectsShowSwal |
| src/BootstrapBlazor.Server/Components/Samples/Selects.razor.cs | Included ShowSwal in sample attribute list |
| src/BootstrapBlazor/BootstrapBlazor.csproj | Bumped version to 9.6.4-beta03 |
Comments suppressed due to low confidence (2)
src/BootstrapBlazor.Server/Locales/en-US.json:3271
- [nitpick] Consider changing this to "Whether to show the Swal confirmation popup" for grammatical correctness and consistent capitalization of "Swal".
"SelectsShowSwal": "Whether show the swal confirm popup"
src/BootstrapBlazor/Components/Select/Select.razor.cs:65
- Add unit tests to verify that when
ShowSwalis false,SwalService.ShowModalis not invoked, and that selection logic still proceeds correctly.
public bool ShowSwal { get; set; } = true;
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6053 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 701 701
Lines 30957 30956 -1
Branches 4378 4378
=========================================
- Hits 30957 30956 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 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.
Link issues
fixes #6035
Summary By Copilot
This pull request introduces a new
ShowSwalparameter to theSelect<TValue>component, allowing developers to control whether a Swal confirmation popup is displayed during item selection. Additionally, associated localization strings have been added, and the project version has been updated.Feature Addition:
ShowSwalParametersrc/BootstrapBlazor/Components/Select/Select.razor.cs: Added a new[Parameter]propertyShowSwalto control whether the Swal confirmation popup is displayed whenOnBeforeSelectedItemChangereturns true. Default is set totrue. Updated theOnClickItemmethod to respect this new parameter. [1] [2] [3]Localization Updates
src/BootstrapBlazor.Server/Locales/en-US.json: Added a new localization stringSelectsShowSwalfor theShowSwalparameter description.src/BootstrapBlazor.Server/Locales/zh-CN.json: Added a Chinese localization string forSelectsShowSwal.Code Example Updates
src/BootstrapBlazor.Server/Components/Samples/Selects.razor.cs: Updated theGetAttributesmethod to include the newShowSwalproperty in the component's attribute list.Project Version Update
src/BootstrapBlazor/BootstrapBlazor.csproj: Incremented the project version from9.6.4-beta02to9.6.4-beta03.Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Add a ShowSwal parameter to the Select component for optional display of confirmation popups, update related sample metadata and localization, and bump the project version.
New Features:
Enhancements:
Build:
Documentation: