Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Mar 21, 2025

Link issues

fixes #5681

Summary By Copilot

This pull request includes several updates to the MultiSelect component and its usage in the MultiSelects sample. The changes focus on enhancing the virtualized item handling and updating related tests.

Enhancements to MultiSelect component:

  • Added a new parameter DefaultVirtualizeItemText to the MultiSelect component to set default text for virtualized items. (src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs)
  • Implemented the GetItemsByVirtualize method to handle mapping virtualized item values to their corresponding texts. (src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs)
  • Updated the OnParametersSet method to use the new GetItemsByVirtualize method for virtualized items. (src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs)

Changes to MultiSelects sample:

  • Modified the MultiSelects.razor file to use the new DefaultVirtualizeItemText parameter and updated the binding values for virtualized items. (src/BootstrapBlazor.Server/Components/Samples/MultiSelects.razor) [1] [2]
  • Updated the initialization logic to set both the value and text for virtualized items. (src/BootstrapBlazor.Server/Components/Samples/MultiSelects.razor.cs)

Updates to unit tests:

  • Added a new test to verify the functionality of DefaultVirtualizeItemText in virtualized items. (test/UnitTest/Components/MultiSelectTest.cs) [1] [2]

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ 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
  • Merge the latest code from the main branch

Summary by Sourcery

Adds the DefaultVirtualizeItemText parameter to the MultiSelect component to allow setting default text for virtualized items. This change also updates the MultiSelects sample to use the new parameter and updates the initialization logic for virtualized items.

New Features:

  • Adds DefaultVirtualizeItemText parameter to the MultiSelect component to allow setting default text for virtualized items.
  • Implements the GetItemsByVirtualize method to handle mapping virtualized item values to their corresponding texts.

Tests:

  • Adds a new test to verify the functionality of DefaultVirtualizeItemText in virtualized items.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 21, 2025

Reviewer's Guide by Sourcery

This pull request introduces the DefaultVirtualizeItemText parameter to the MultiSelect component, allowing users to set default text for virtualized items. The implementation includes modifications to the MultiSelect component, updates to the MultiSelects sample to demonstrate the new functionality, and the addition of a unit test to ensure the correct behavior of the DefaultVirtualizeItemText parameter.

Sequence diagram for GetItemsByVirtualize method

sequenceDiagram
    participant MultiSelect
    MultiSelect->MultiSelect: GetItemsByVirtualize()
    MultiSelect->MultiSelect: CurrentValueAsString.Split()
    alt DefaultVirtualizeItemText is not null or empty
        MultiSelect->MultiSelect: DefaultVirtualizeItemText.Split()
    end
    loop For each value
        MultiSelect->MultiSelect: Create SelectedItem
    end
    MultiSelect-->MultiSelect: Return List<SelectedItem>
Loading

File-Level Changes

Change Details Files
Added a new parameter DefaultVirtualizeItemText to the MultiSelect component to set default text for virtualized items.
  • Added DefaultVirtualizeItemText parameter.
  • Implemented the GetItemsByVirtualize method to handle mapping virtualized item values to their corresponding texts.
  • Updated the OnParametersSet method to use the new GetItemsByVirtualize method for virtualized items.
src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs
Updated the MultiSelects sample to use the new DefaultVirtualizeItemText parameter and updated the binding values for virtualized items.
  • Modified the MultiSelects.razor file to use the new DefaultVirtualizeItemText parameter.
  • Updated the initialization logic to set both the value and text for virtualized items.
src/BootstrapBlazor.Server/Components/Samples/MultiSelects.razor
src/BootstrapBlazor.Server/Components/Samples/MultiSelects.razor.cs
Added a new test to verify the functionality of DefaultVirtualizeItemText in virtualized items.
  • Added a new test case DefaultVirtualizeItemText_Ok to verify the functionality of DefaultVirtualizeItemText.
test/UnitTest/Components/MultiSelectTest.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#5681 Add a DefaultVirtualizeItemText parameter to the MultiSelect component.
#5681 Implement logic to handle mapping virtualized item values to their corresponding texts using the new parameter.
#5681 Update the MultiSelects sample to use the new DefaultVirtualizeItemText parameter and update related tests.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@bb-auto bb-auto bot added the enhancement New feature or request label Mar 21, 2025
@bb-auto bb-auto bot added this to the v9.4.0 milestone Mar 21, 2025
Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

We encountered an error and are unable to review this PR. We have been notified and are working to fix it.

You can try again by commenting this pull request with @sourcery-ai review, or contact us for help.

@codecov
Copy link

codecov bot commented Mar 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (9c752c8) to head (4923368).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #5682   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          654       654           
  Lines        29689     29705   +16     
  Branches      4217      4219    +2     
=========================================
+ Hits         29689     29705   +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ArgoZhang ArgoZhang merged commit 5e0ea8f into main Mar 21, 2025
3 checks passed
@ArgoZhang ArgoZhang deleted the refactor-multi-select branch March 21, 2025 12:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(MultiSelect): add DefaultVirtualizeItemText parameter

2 participants