-
-
Notifications
You must be signed in to change notification settings - Fork 362
feat(Table): multiple select column adapts to compact mode #7068
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
Reviewer's GuideIntroduces support for a compact-mode multiple select column in the Table component by adding a configurable compact width, updating layout calculations, and reflecting these changes in samples, settings, tests, and styles. Entity relationship diagram for updated TableSettings data modelerDiagram
TABLESETTINGS {
int CheckboxColumnWidth
int CheckboxColumnCompactWidth
int RowHeaderWidth
}
TABLESETTINGS ||--o| TABLE : has
TABLE {
int CheckboxColumnWidth
int CheckboxColumnCompactWidth
}
Class diagram for updated Table component and TableSettingsclassDiagram
class TableSettings {
+int CheckboxColumnWidth
+int CheckboxColumnCompactWidth
+int RowHeaderWidth
...
}
class Table {
+int CheckboxColumnWidth
+int CheckboxColumnCompactWidth
+TableSize TableSize
+int MultiColumnWidth
+void OnInitParameters()
...
}
TableSettings <|-- Table
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 new XML doc comments for CheckboxColumnCompactWidth (and in TableSettings) are in Chinese—please convert them to English to stay consistent with the rest of the codebase.
- The SCSS tweak changing
.table-smpadding may have unexpected visual side effects; double-check that this adjustment only impacts compact checkbox columns or consider isolating it under a more specific selector. - Using
== 0to detect whether CheckboxColumnCompactWidth was provided can conflate an explicit zero value with “unset”; consider using a nullable parameter or another flag to distinguish user input from default fallback.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new XML doc comments for CheckboxColumnCompactWidth (and in TableSettings) are in Chinese—please convert them to English to stay consistent with the rest of the codebase.
- The SCSS tweak changing `.table-sm` padding may have unexpected visual side effects; double-check that this adjustment only impacts compact checkbox columns or consider isolating it under a more specific selector.
- Using `== 0` to detect whether CheckboxColumnCompactWidth was provided can conflate an explicit zero value with “unset”; consider using a nullable parameter or another flag to distinguish user input from default fallback.
## Individual Comments
### Comment 1
<location> `src/BootstrapBlazor/Components/Table/Table.razor.cs:889-890` </location>
<code_context>
CheckboxColumnWidth = op.TableSettings.CheckboxColumnWidth;
}
+ if (CheckboxColumnCompactWidth == 0)
+ {
+ CheckboxColumnCompactWidth = op.TableSettings.CheckboxColumnCompactWidth;
+ }
</code_context>
<issue_to_address>
**suggestion (bug_risk):** Default value assignment for CheckboxColumnCompactWidth may mask intentional zero values.
Using '== 0' here conflates unset and intentional zero values. Consider a nullable type or a distinct sentinel value to differentiate these cases.
Suggested implementation:
```csharp
[Parameter]
public int? CheckboxColumnCompactWidth { get; set; }
```
```csharp
if (CheckboxColumnCompactWidth == null)
{
CheckboxColumnCompactWidth = op.TableSettings.CheckboxColumnCompactWidth;
}
```
</issue_to_address>
### Comment 2
<location> `src/BootstrapBlazor/Components/ErrorLogger/ErrorLogger.cs:105` </location>
<code_context>
protected override void BuildRenderTree(RenderTreeBuilder builder)
{
builder.OpenComponent<CascadingValue<IErrorLogger>>(0);
- builder.AddAttribute(1, nameof(CascadingValue<IErrorLogger>.Value), this);
- builder.AddAttribute(2, nameof(CascadingValue<IErrorLogger>.IsFixed), true);
- builder.AddAttribute(3, nameof(CascadingValue<IErrorLogger>.ChildContent), RenderContent);
+ builder.AddAttribute(1, nameof(CascadingValue<>.Value), this);
+ builder.AddAttribute(2, nameof(CascadingValue<>.IsFixed), true);
+ builder.AddAttribute(3, nameof(CascadingValue<>.ChildContent), RenderContent);
</code_context>
<issue_to_address>
**issue (bug_risk):** Using open generic type for attribute name may cause runtime issues.
Referencing an open generic type in attribute names may not behave correctly at runtime. Please confirm this change is compatible with the framework and will not affect component behavior.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7068 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 745 745
Lines 32550 32562 +12
Branches 4512 4513 +1
=========================================
+ Hits 32550 32562 +12
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
This PR adds support for different checkbox column widths based on table size (Normal vs Compact mode). When a table is in Compact mode, the checkbox column width is reduced from 36px to 28px to better fit the reduced padding.
Key changes:
- Added
CheckboxColumnCompactWidthproperty to control checkbox column width in compact mode (default 28px) - Updated CSS horizontal padding for compact tables from .25rem to .35rem
- Refactored generic type references to use cleaner
<>syntax instead of fully specified types
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/BootstrapBlazor/Options/TableSettings.cs | Added CheckboxColumnCompactWidth configuration property with default value of 28 |
| src/BootstrapBlazor/Components/Table/Table.razor.cs | Added CheckboxColumnCompactWidth parameter and initialization logic |
| src/BootstrapBlazor/Components/Table/Table.razor.Sort.cs | Updated width calculation logic to use compact width when table size is not Normal |
| src/BootstrapBlazor/Components/Table/Table.razor.scss | Increased compact table horizontal padding from .25rem to .35rem |
| test/UnitTest/Components/TableTest.cs | Added test coverage for compact mode checkbox width and refactored generic type references |
| src/BootstrapBlazor.Server/Components/Samples/Table/Tables.razor | Enhanced sample page with interactive switch to demonstrate size differences |
| src/BootstrapBlazor.Server/Components/Samples/Table/Tables.razor.cs | Added state variable for compact mode toggle |
| src/BootstrapBlazor/Components/ErrorLogger/ErrorLogger.cs | Refactored to use cleaner generic type syntax |
| src/BootstrapBlazor/BootstrapBlazor.csproj | Version bumps for both Visual Studio 17.0 and 18.0 branches |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Link issues
fixes #7067
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Enable multiple-select checkbox column to adjust its width and position in compact table mode by introducing a new compact width parameter and updating layout logic, samples, CSS, and tests accordingly.
New Features:
Enhancements:
Tests:
Chores: