-
-
Notifications
You must be signed in to change notification settings - Fork 362
feat(Table): add ShowMoreButton parameter #7048
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
# Conflicts: # src/BootstrapBlazor/Components/Table/Table.razor
Reviewer's GuideThis 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 ShowMoreButtonclassDiagram
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
Class diagram for new Dropdown item interface and componentsclassDiagram
class IDropdownItem {
}
class DropdownItem {
implements IDropdownItem
}
class DropdownDivider {
implements IDropdownItem
}
DropdownItem ..|> IDropdownItem
DropdownDivider ..|> IDropdownItem
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 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.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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 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
DropdownItemandDropdownDividercomponents withIDropdownIteminterface - Adds
ShowMoreButtonandMoreButtonDropdownTemplateparameters to Table component - Adds
TableMoreButtonIconto 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 Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ 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.
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"); |
Copilot
AI
Nov 1, 2025
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.
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.
| cut.Contains("<div>dropdown-item-more-template</div"); | |
| cut.Contains("<div>dropdown-item-more-template</div>"); |
| </td>; | ||
|
|
||
| RenderFragment<TItem> RenderMoreButton => item => | ||
| @<Dropdown TValue="string" Color="Color.Secondary" IsFixedButtonText="true" FixedButtonText="更多" |
Copilot
AI
Nov 1, 2025
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.
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).
| </td> | ||
| } | ||
| @if (RowButtonTemplate != null) | ||
| @foreach (var col in GetVisibleColumns()) |
Copilot
AI
Nov 1, 2025
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.
This assignment to col is useless, since its value is never read.
| @foreach (var col in GetVisibleColumns()) | |
| @foreach (var _ in GetVisibleColumns()) |
Link issues
fixes #7047
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
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:
Bug Fixes:
Enhancements: