Skip to content

Conversation

@ArgoZhang
Copy link
Member

@ArgoZhang ArgoZhang commented Nov 1, 2025

Link issues

fixes #7047

Summary By Copilot

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

Enable a customizable inline "More" dropdown button in table rows by adding ShowMoreButton, MoreButtonDropdownTemplate, and an associated icon parameter, while updating the sample demonstration and correcting minor errors.

New Features:

  • Add ShowMoreButton parameter and MoreButtonDropdownTemplate to Table to render an inline "More" dropdown per row
  • Introduce MoreButtonIcon parameter with default registration in the icon theme for the new button

Bug Fixes:

  • Fix typo in instance creation error message
  • Adjust sample query logic to use Count checks instead of Any() for filters and searches

Enhancements:

  • Update TablesSearch sample to showcase the ShowMoreButton feature and toast-based action handling

Copilot AI review requested due to automatic review settings November 1, 2025 09:06
@bb-auto bb-auto bot added the enhancement New feature or request label Nov 1, 2025
@bb-auto bb-auto bot added this to the 10.0.0 milestone Nov 1, 2025
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 1, 2025

Reviewer's Guide

This PR extends the Table component with a configurable inline “More” dropdown button by introducing new parameters, render logic, and icon registration, updates sample usage to demonstrate the feature, and applies minor code fixes.

Class diagram for updated Table component with ShowMoreButton

classDiagram
class Table_TItem {
  +bool ShowMoreButton
  +RenderFragment_TItem MoreButtonDropdownTemplate
  +string MoreButtonIcon
  +RenderFragment_TItem RowButtonTemplate
}
class Dropdown_TValue {
}
class DropdownItem {
}
class DropdownDivider {
}
Table_TItem --> Dropdown_string : uses
Dropdown_string --> DropdownItem : contains
Dropdown_string --> DropdownDivider : contains
Loading

Class diagram for new Dropdown item interface and components

classDiagram
class IDropdownItem {
}
class DropdownItem {
  implements IDropdownItem
}
class DropdownDivider {
  implements IDropdownItem
}
DropdownItem ..|> IDropdownItem
DropdownDivider ..|> IDropdownItem
Loading

File-Level Changes

Change Details Files
Add configurable inline “More” dropdown button to Table component
  • Introduced ShowMoreButton, MoreButtonDropdownTemplate, and MoreButtonIcon parameters
  • Embedded RenderMoreButton fragment in Table.razor markup for row-level rendering
  • Added MoreButtonIcon parameter in localization defaults
src/BootstrapBlazor/Components/Table/Table.razor
src/BootstrapBlazor/Components/Table/Table.razor.Edit.cs
src/BootstrapBlazor/Components/Table/Table.razor.Localization.cs
Register and initialize MoreButtonIcon in theme and Table defaults
  • Extended ComponentIcons enum with TableMoreButtonIcon
  • Mapped TableMoreButtonIcon to Bootstrap, FontAwesome, and MaterialDesign icon sets
  • Assigned default MoreButtonIcon in Table.OnInitParameters
src/BootstrapBlazor/Enums/ComponentIcons.cs
src/BootstrapBlazor/Components/Table/Table.razor.cs
src/BootstrapBlazor/Icons/BootstrapIcons.cs
src/BootstrapBlazor/Icons/FontAwesomeIcons.cs
src/BootstrapBlazor/Icons/MaterialDesignIcons.cs
Demonstrate MoreButton usage in sample TablesSearch
  • Enabled ShowMoreButton and ShowCardView options in sample table
  • Defined MoreButtonDropdownTemplate with DropdownItem and DropdownDivider entries
  • Injected ToastService and implemented OnAction handler for sample actions
src/BootstrapBlazor.Server/Components/Samples/Table/TablesSearch.razor
src/BootstrapBlazor.Server/Components/Samples/Table/TablesSearch.razor.cs
Minor code fixes and optimizations
  • Corrected typo in Table creation error message
  • Replaced .Any() checks in query methods with Count comparisons for performance
src/BootstrapBlazor/Components/Table/Table.razor.Edit.cs
src/BootstrapBlazor.Server/Components/Samples/Table/TablesSearch.razor.cs

Assessment against linked issues

Issue Objective Addressed Explanation
#7047 Add ShowMoreButton parameter to the Table component to control the display of an inline 'More' button in each row.
#7047 Add MoreButtonDropdownTemplate parameter to the Table component to allow customization of the dropdown menu shown when the 'More' button is clicked.

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!

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

@ArgoZhang ArgoZhang changed the title feat(Table): add MoreButtonDropdownTemplate parameter feat(Table): add ShowMoreButton parameter Nov 1, 2025
sourcery-ai[bot]
sourcery-ai bot previously approved these changes Nov 1, 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 there - I've reviewed your changes - here's some feedback:

  • The ShowMoreButton rendering logic is duplicated in two places—consider extracting it into a shared method or component to reduce code repetition.
  • The fixed button text "更多" is hardcoded; you may want to expose a parameter or use the localization system so it can be customized per language.
  • Right now the dropdown button still renders even if MoreButtonDropdownTemplate is null, resulting in an empty menu—consider only showing the button when there are actual items to display.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The ShowMoreButton rendering logic is duplicated in two places—consider extracting it into a shared method or component to reduce code repetition.
- The fixed button text "更多" is hardcoded; you may want to expose a parameter or use the localization system so it can be customized per language.
- Right now the dropdown button still renders even if MoreButtonDropdownTemplate is null, resulting in an empty menu—consider only showing the button when there are actual items to display.

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.

Copy link
Contributor

Copilot AI left a 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 adds a "More" button feature to the Table component, providing a dropdown menu for additional row actions. The feature includes new dropdown components (DropdownItem and DropdownDivider) and integrates them into the Table component's row button toolbar.

Key changes:

  • Introduces DropdownItem and DropdownDivider components with IDropdownItem interface
  • Adds ShowMoreButton and MoreButtonDropdownTemplate parameters to Table component
  • Adds TableMoreButtonIcon to icon theme configurations (Bootstrap, FontAwesome, Material Design)
  • Fixes typo in error message ("instrance" → "instance")

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ComponentIcons.cs Adds TableMoreButtonIcon enum value for the new more button icon
BootstrapIcons.cs, FontAwesomeIcons.cs, MaterialDesignIcons.cs Maps TableMoreButtonIcon to respective icon sets
Table.razor.cs Initializes MoreButtonIcon from icon theme
Table.razor.Localization.cs Adds MoreButtonIcon parameter to Table component
Table.razor.Edit.cs Adds ShowMoreButton and MoreButtonDropdownTemplate parameters; fixes typo in error message
Table.razor Adds rendering logic for More button dropdown in both card view and table view
IDropdownItem.cs Defines empty marker interface for dropdown items
DropdownItem.cs New component class for dropdown menu items
DropdownDivider.cs New component class for dropdown dividers
Dropdown.razor.cs Adds support for rendering DropdownItem and DropdownDivider components
Dropdown.razor Adds rendering template for new dropdown item components
TablesSearch.razor, TablesSearch.razor.cs Demonstrates the new More button feature with sample dropdown items
Comments suppressed due to low confidence (1)

src/BootstrapBlazor/Components/Dropdown/Dropdown.razor:84

  • Inconsistent indentation: these lines use tabs while the existing code in this file uses spaces (see lines 6-59). This should be changed to use spaces for consistency.
            @ItemsTemplate
        }
    </div>
</div>


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Nov 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1905435) to head (6bff1bf).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7048   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          745       745           
  Lines        32515     32532   +17     
  Branches      4506      4510    +4     
=========================================
+ Hits         32515     32532   +17     
Flag Coverage Δ
BB 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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 requested a review from Copilot November 1, 2025 14:04
@ArgoZhang ArgoZhang merged commit 8640cbf into main Nov 1, 2025
9 checks passed
@ArgoZhang ArgoZhang deleted the refactor-more branch November 1, 2025 14:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

});
});

cut.Contains("<div>dropdown-item-more-template</div");
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

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

The assertion is missing a closing > in the HTML tag. The string should be \"<div>dropdown-item-more-template</div>\" to properly match the complete closing tag.

Suggested change
cut.Contains("<div>dropdown-item-more-template</div");
cut.Contains("<div>dropdown-item-more-template</div>");

Copilot uses AI. Check for mistakes.
</td>;

RenderFragment<TItem> RenderMoreButton => item =>
@<Dropdown TValue="string" Color="Color.Secondary" IsFixedButtonText="true" FixedButtonText="更多"
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

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

The text '更多' (meaning 'More' in Chinese) is hardcoded. This should be localized using a resource string or parameter to support internationalization, similar to how other button texts in the Table component are localized (e.g., EditButtonText, DeleteButtonText).

Copilot uses AI. Check for mistakes.
</td>
}
@if (RowButtonTemplate != null)
@foreach (var col in GetVisibleColumns())
Copy link

Copilot AI Nov 1, 2025

Choose a reason for hiding this comment

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

This assignment to col is useless, since its value is never read.

Suggested change
@foreach (var col in GetVisibleColumns())
@foreach (var _ in GetVisibleColumns())

Copilot uses AI. Check for mistakes.
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(Table): add ShowMoreButton parameter

2 participants