Skip to content

doc(Table): update parameter docs#7537

Merged
ArgoZhang merged 9 commits intomainfrom
dev-test
Jan 18, 2026
Merged

doc(Table): update parameter docs#7537
ArgoZhang merged 9 commits intomainfrom
dev-test

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Jan 18, 2026

Link issues

fixes #7536

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

Replace manually maintained Table and Chart parameter documentation in samples with automatically generated attribute tables, and align related metadata and styling with version 10.2.2.

Enhancements:

  • Improve AttributeTable component layout and styling, including bordered/striped tables and an indicator for auto-generated content.
  • Refine XML documentation comments for localization and lambda utilities for clearer English descriptions and API references.

Documentation:

  • Switch Table and Chart sample pages to use auto-generated attribute documentation based on component types instead of hardcoded attribute lists.
  • Update AttributeItem default version and add version tags to relevant parameters to reflect version 10.2.2.

Copilot AI review requested due to automatic review settings January 18, 2026 02:23
@bb-auto bb-auto Bot added the documentation Improvements or additions to documentation label Jan 18, 2026
@bb-auto bb-auto Bot added this to the v10.2.0 milestone Jan 18, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jan 18, 2026

Reviewer's Guide

Refactors component parameter documentation to use auto-generated AttributeTable metadata, adds version annotations to several parameters, and makes minor doc and styling tweaks, removing now-redundant hand-maintained attribute/method lists for Table and Charts samples.

Class diagram for AttributeTable usage with auto-generated metadata

classDiagram
    class AttributeTable {
        +string? Title
        +IEnumerable~AttributeItem~? Items
        +Type? Type
        +bool ShowFooter
    }

    class AttributeItem {
        +string Name
        +string Description
        +string Type
        +string ValueList
        +string DefaultValue
        +string Version
    }

    class Table_TItem_ {
        +bool IsBordered
        +bool IsStriped
    }

    class Chart {
    }

    class BootstrapComponentBase {
        +Dictionary~string, object~ AdditionalAttributes
    }

    AttributeTable ..> AttributeItem : displays
    AttributeTable ..> Table_TItem_ : wraps
    AttributeTable --|> BootstrapComponentBase
    Table_TItem_ ..> AttributeItem : metadata source
    Chart ..> AttributeItem : metadata source
    AttributeItem --> "10.2.2" Version : default
Loading

Flow diagram for AttributeTable auto-generation of parameter docs

flowchart TD
    A_Start["Render AttributeTable"] --> B_CheckType["Type is null?"]

    B_CheckType -->|Yes| C_UseItems["Use Items parameter as attribute metadata"]
    B_CheckType -->|No| D_AutoGenerate["Reflect over Type to build AttributeItem collection"]

    D_AutoGenerate --> E_SetMark["Set table-attr-mark text to 'Automatically generated'"]
    C_UseItems --> F_RenderTable["Render Table AttributeItem with IsBordered=true IsStriped=true"]
    E_SetMark --> F_RenderTable

    F_RenderTable --> G_ShowFooter["Show footer when ShowFooter is true"]
    G_ShowFooter --> H_End["Attribute documentation table displayed"]
Loading

File-Level Changes

Change Details Files
Switch Table and Chart samples to use auto-generated parameter documentation instead of manually maintained attribute lists.
  • Remove GetAttributes and GetMethods helpers from Tables.razor.cs and Charts/Index.razor.cs that returned hard-coded AttributeItem and MethodItem arrays for Table and Chart components.
  • Replace AttributeTable usages that passed Items from those helpers with AttributeTable instances configured with Type (typeof(Table<>) and typeof(Chart)) and enable footer display on the Table attribute table.
  • Update AttributeTable markup to show the title as a code-style label and, when Type is set, render an 'Automatically generated' marker in the header description.
src/BootstrapBlazor.Server/Components/Samples/Table/Tables.razor.cs
src/BootstrapBlazor.Server/Components/Samples/Table/Tables.razor
src/BootstrapBlazor.Server/Components/Samples/Charts/Index.razor.cs
src/BootstrapBlazor.Server/Components/Samples/Charts/Index.razor
Improve AttributeTable presentation and styling.
  • Wrap the AttributeTable header in a flex container that shows the title and an optional 'Automatically generated' marker.
  • Apply bordered and striped styles to the AttributeTable's internal Table component to enhance readability.
  • Add a dedicated CSS file for AttributeTable to control margins, layout, and marker font size.
src/BootstrapBlazor.Server/Components/Components/AttributeTable.razor
src/BootstrapBlazor.Server/Components/Components/AttributeTable.razor.css
Annotate specific parameters and metadata with explicit version information for 10.2.2 and align localization/docs.
  • Set the default Version property on AttributeItem to '10.2.2' for display in parameter documentation tables.
  • Add 10.2.2 XML doc tags to key parameters on BootstrapComponentBase, ContextMenuTrigger, and Layout components so they can be surfaced in generated docs.
  • Tidy up JSON localization extension docs and lambda extension XML comments, including fixing English descriptions and XML cref references from raw generics to see-cref notation.
src/BootstrapBlazor.Server/Data/AttributeItem.cs
src/BootstrapBlazor/Components/BaseComponents/BootstrapComponentBase.cs
src/BootstrapBlazor/Components/ContextMenu/ContextMenuTrigger.cs
src/BootstrapBlazor/Components/Layout/Layout.razor.cs
src/BootstrapBlazor/Localization/Json/JsonLocalizationServiceCollectionExtensions.cs
src/BootstrapBlazor/Extensions/LambdaExtensions.cs
src/BootstrapBlazor.Server/Locales/en-US.json
src/BootstrapBlazor.Server/Locales/zh-CN.json

Assessment against linked issues

Issue Objective Addressed Explanation
#7536 Update the Table component parameter documentation (docs page) to reflect the current API.
#7536 Add or update sample code for the Table component in its documentation page. The PR modifies how parameter documentation is rendered (switching to AttributeTable with Type="typeof(Table<>)") and styling of the attribute table, but it does not introduce new demo/sample usage code for the Table component beyond what already existed.

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 merged commit a97bd38 into main Jan 18, 2026
7 of 8 checks passed
@ArgoZhang ArgoZhang deleted the dev-test branch January 18, 2026 02:24
Copy link
Copy Markdown
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 - I've found 1 issue, and left some high level feedback:

  • AttributeTable now supports a Type parameter but the markup still always renders the Title span; when using Type without a Title (e.g., in Tables.razor and Charts/Index.razor), this will produce an empty label, so consider hiding the label element or providing a sensible default when Title is null or empty.
  • AttributeItem.Version is now hardcoded to "10.2.2"; to avoid future drift, consider deriving this from a central version source (e.g., assembly or package version) instead of a literal string.
  • The Table sample no longer renders MethodTable or exposes GetMethods, while other samples (like Charts) still show method metadata; if the intent is to keep method documentation consistent across components, consider adding an equivalent auto-generated method table or clarifying the difference in behavior.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- AttributeTable now supports a Type parameter but the markup still always renders the Title span; when using Type without a Title (e.g., in Tables.razor and Charts/Index.razor), this will produce an empty label, so consider hiding the label element or providing a sensible default when Title is null or empty.
- AttributeItem.Version is now hardcoded to "10.2.2"; to avoid future drift, consider deriving this from a central version source (e.g., assembly or package version) instead of a literal string.
- The Table sample no longer renders MethodTable or exposes GetMethods, while other samples (like Charts) still show method metadata; if the intent is to keep method documentation consistent across components, consider adding an equivalent auto-generated method table or clarifying the difference in behavior.

## Individual Comments

### Comment 1
<location> `src/BootstrapBlazor.Server/Components/Components/AttributeTable.razor:2-8` </location>
<code_context>
 <div class="table-attr">
-    <h4>@Title</h4>
+    <p class="table-attr-desc">
+        <span class="code-label">@Title</span>
+        @if (Type != null)
+        {
+            <span class="table-attr-mark">Automatically generated</span>
+        }
</code_context>

<issue_to_address>
**suggestion:** Handle cases where `Title` is null but `Type` is set to avoid an empty label next to the marker.

In this layout, when `Title` is null but `Type` is not, the `code-label` span will be empty while the `Automatically generated` marker still shows, which is visually awkward. Consider either falling back to something like `Type.Name` (or a localized default) when `Title` is null, or omitting the title span entirely in that case so the marker doesn’t appear detached.

```suggestion
    <p class="table-attr-desc">
        @if (!string.IsNullOrEmpty(Title))
        {
            <span class="code-label">@Title</span>
        }
        else if (Type != null)
        {
            <span class="code-label">@Type.Name</span>
        }

        @if (Type != null)
        {
            <span class="table-attr-mark">Automatically generated</span>
        }
    </p>
```
</issue_to_address>

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
Copy Markdown

codecov Bot commented Jan 18, 2026

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #7537   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          748       748           
  Lines        33012     33012           
  Branches      4588      4588           
=========================================
  Hits         33012     33012           
Flag Coverage Δ
BB 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
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 pull request refactors the documentation generation system to be more automated by removing hardcoded attribute lists and leveraging reflection-based attribute generation. The PR removes over 1,300 lines of redundant code while improving maintainability.

Changes:

  • Removed hardcoded attribute definitions from Tables and Charts sample components (1,149 lines)
  • Updated AttributeTable component to support automatic attribute generation via reflection
  • Cleaned up localization files by removing 170 unused Table attribute strings from both zh-CN and en-US
  • Improved XML documentation formatting for parameters in several components
  • Changed default version value in AttributeItem from empty string to "10.2.2"

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Tables.razor.cs Removed 1,013 lines of hardcoded GetAttributes() and GetMethods() methods
Tables.razor Changed to use Type parameter for automatic attribute generation
Charts/Index.razor.cs Removed 136 lines of hardcoded GetAttributes() method
Charts/Index.razor Changed to use Type parameter for automatic attribute generation
AttributeTable.razor Added UI improvements for displaying automatically generated attributes
AttributeTable.razor.css Added new styling for the updated AttributeTable component
zh-CN.json, en-US.json Removed 170 unused Table attribute localization strings from each file
LambdaExtensions.cs Fixed English translation and removed redundant remarks/returns tags
JsonLocalizationServiceCollectionExtensions.cs Improved parameter documentation formatting
Layout.razor.cs, ContextMenuTrigger.cs, BootstrapComponentBase.cs Added version tags for parameters
AttributeItem.cs Changed default version from empty string to "10.2.2"

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc(Table): update parameter docs

2 participants