Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Mar 20, 2025

Link issues

fixes #5663

Summary By Copilot

This pull request includes several changes to enhance the functionality and user interface of the BootstrapBlazor components. The most important changes include the addition of virtual scrolling support, updates to localization files, and improvements to the AutoComplete and AutoFill components.

Enhancements to Components:

  • Virtual Scrolling Support:
    • Added virtual scrolling support to AutoFill, MultiSelect, and Select components by introducing the IsVirtualize property. This allows handling large datasets more efficiently. ([[1]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-c5d5ab295d4887ad9236507061a2f974df8e49dd7e09e4c37f2e754c3f722fd8R75-R142), [[2]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-9c197d1f062687015b933f8a75ef062a1e864d5e9e99d5dc31522f87da44a858R36-R44), [[3]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-66ded6d378824103dd1be66f7ef69a400ae390c6ef91922c06957256290cefbfR477-R484), [[4]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-f9acebf8daf7961532146196175320f775b3539b8518fa39c101ad7d3e6bfe1dR418-R425))

Localization Updates:

  • Localization for Virtual Scrolling:
    • Updated the English and Chinese localization files to include descriptions and attributes for the new virtual scrolling feature. ([[1]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-790d42ebea731775f0fee88a92b20fadb044e53706fd6d3025dfa095df9b1b41L2156-R2158), [[2]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-790d42ebea731775f0fee88a92b20fadb044e53706fd6d3025dfa095df9b1b41L3031-R3034), [[3]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-790d42ebea731775f0fee88a92b20fadb044e53706fd6d3025dfa095df9b1b41L3207-R3211), [[4]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-746b8cc3c80dd10d0a1bf77b8d6571652e15bcc7c33dcac0954d93b1a728cc7fL2156-R2158), [[5]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-746b8cc3c80dd10d0a1bf77b8d6571652e15bcc7c33dcac0954d93b1a728cc7fL3031-R3034), [[6]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-746b8cc3c80dd10d0a1bf77b8d6571652e15bcc7c33dcac0954d93b1a728cc7fL3207-R3211))

Component Improvements:

  • AutoComplete Component:

    • Improved the AutoComplete component by adding a shadow to the dropdown menu for better visual distinction. ([[1]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-d7907c9240cf11222f4ab3e96b2d2f22f36fa0bc6422d99acea9de2748133930L26-R26), [[2]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-ff3e4641ea68928ba99380b62a108f794647be2ed8467bd58236bab40e9e05aaL3-L7), [[3]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-ff3e4641ea68928ba99380b62a108f794647be2ed8467bd58236bab40e9e05aaL18-R13))
  • AutoFill Component:

    • Refactored the AutoFill component to support virtual scrolling and added new methods for custom filtering and querying data asynchronously. ([[1]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-c5d5ab295d4887ad9236507061a2f974df8e49dd7e09e4c37f2e754c3f722fd8L12-R13), [[2]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-9c197d1f062687015b933f8a75ef062a1e864d5e9e99d5dc31522f87da44a858R58-R60), [[3]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-9c197d1f062687015b933f8a75ef062a1e864d5e9e99d5dc31522f87da44a858R69-R89), [[4]](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-342511820cd79fb7947f85e2341e878a70f345e6db243e24567a33f1733e8c11R2))

Project Configuration:

  • Version Update:
    • Updated the project version to 9.5.0-beta07 to reflect the new changes and improvements. ([src/BootstrapBlazor/BootstrapBlazor.csprojL4-R4](https://github.com/dotnetcore/BootstrapBlazor/pull/5664/files#diff-07918ce1b66955e76da5cd0ffa38512cce984fa2a09735a60e0db37b45235527L4-R4))

These changes collectively enhance the performance, usability, and internationalization of the BootstrapBlazor components.

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 virtual scrolling support to the AutoFill, MultiSelect, and Select components via the IsVirtualize parameter. Also adds a clearable option to the AutoFill component and improves the AutoComplete component by adding a shadow to the dropdown menu.

New Features:

  • Adds virtual scrolling support to AutoFill, MultiSelect, and Select components via the IsVirtualize parameter to handle large datasets more efficiently.
  • Adds a clearable option to the AutoFill component.

Tests:

  • Adds tests for the IsVirtualize parameter of the AutoFill component.

@bb-auto bb-auto bot added the enhancement New feature or request label Mar 20, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Mar 20, 2025

Reviewer's Guide by Sourcery

This pull request introduces virtual scrolling support to the AutoFill, MultiSelect, and Select components, enhances the AutoComplete component with a dropdown shadow, and refactors the AutoFill component to support custom filtering and querying data asynchronously. Localization files were updated, and the project version was bumped to 9.5.0-beta07.

Sequence diagram for AutoFill with Virtualization and OnQueryAsync

sequenceDiagram
    participant User
    participant AutoFill Component
    participant Virtualize Component
    participant Data Source

    User->>AutoFill Component: Enters text for filtering
    AutoFill Component->>Virtualize Component: TriggerFilter(searchText)
    Virtualize Component->>Data Source: OnQueryAsync(VirtualizeQueryOption)
    Data Source-->>Virtualize Component: QueryData with items and total count
    Virtualize Component->>AutoFill Component: ItemsProviderResult
    AutoFill Component->>User: Renders filtered items
Loading

Updated class diagram for AutoComplete component

classDiagram
  class AutoComplete {

  }

  note for AutoComplete "Added shadow to the dropdown menu for better visual distinction."
Loading

File-Level Changes

Change Details Files
Added virtual scrolling support to the AutoFill, MultiSelect, and Select components.
  • Introduced the IsVirtualize property to enable virtual scrolling.
  • Added RowHeight and OverscanCount parameters for configuring the virtualized view.
  • Implemented OnQueryAsync to support asynchronous data loading for virtualized lists.
test/UnitTest/Components/AutoFillTest.cs
src/BootstrapBlazor/Components/AutoFill/AutoFill.razor.cs
src/BootstrapBlazor.Server/Components/Samples/AutoFills.razor
src/BootstrapBlazor/Components/AutoFill/AutoFill.razor
src/BootstrapBlazor.Server/Components/Samples/AutoFills.razor.cs
src/BootstrapBlazor/Components/MultiSelect/MultiSelect.razor.cs
src/BootstrapBlazor.Server/Components/Samples/MultiSelects.razor.cs
src/BootstrapBlazor.Server/Components/Samples/Selects.razor.cs
src/BootstrapBlazor/Components/Select/SelectBase.cs
test/UnitTest/Components/SelectTest.cs
src/BootstrapBlazor/Components/Select/SelectTree.razor
Updated localization files to include descriptions and attributes for the new virtual scrolling feature.
  • Added descriptions for the IsVirtualize property.
  • Added descriptions for the RowHeight property.
  • Added descriptions for the OverscanCount property.
src/BootstrapBlazor.Server/Locales/en-US.json
src/BootstrapBlazor.Server/Locales/zh-CN.json
Improved the AutoComplete component by adding a shadow to the dropdown menu.
  • Added shadow class to the dropdown menu.
src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor
src/BootstrapBlazor/wwwroot/scss/theme/bootstrapblazor.scss
Refactored the AutoFill component to support virtual scrolling and added new methods for custom filtering and querying data asynchronously.
  • Added IsClearable property to allow clearing the selected value.
  • Added OnClearAsync callback for custom clear logic.
  • Modified the component to use Virtualize for rendering items when IsVirtualize is enabled.
  • Updated the component's style and structure to accommodate virtual scrolling.
src/BootstrapBlazor/Components/AutoFill/AutoFill.razor.cs
src/BootstrapBlazor.Server/Components/Samples/AutoFills.razor
src/BootstrapBlazor/Components/AutoFill/AutoFill.razor
src/BootstrapBlazor/Components/AutoFill/AutoFill.razor.scss
Updated the project version to 9.5.0-beta07.
  • Updated the version number in the BootstrapBlazor.csproj file.
src/BootstrapBlazor/BootstrapBlazor.csproj

Assessment against linked issues

Issue Objective Addressed Explanation
#5663 Add IsVirtulize parameter to the AutoFill component.

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 this to the v9.4.0 milestone Mar 20, 2025
sourcery-ai[bot]
sourcery-ai bot previously approved these changes Mar 20, 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.

Hey @ArgoZhang - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider adding a loading indicator when IsVirtualize is enabled and OnQueryAsync is used.
  • The demo code should showcase both Items and OnQueryAsync data sources for the IsVirtualize feature.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@codecov
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (c2a7708) to head (d6ead99).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##              main     #5664    +/-   ##
==========================================
  Coverage   100.00%   100.00%            
==========================================
  Files          654       654            
  Lines        29542     29681   +139     
  Branches      4204      4216    +12     
==========================================
+ Hits         29542     29681   +139     

☔ 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 4f9e787 into main Mar 20, 2025
3 checks passed
@ArgoZhang ArgoZhang deleted the feat-virtualize branch March 20, 2025 01:17
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(AutoFill): add IsVirtulize parameter

2 participants