doc(Samples): update AttributeTable items use Type#7542
Conversation
…ty and higher-order function wrappers.
…s` utility and higher-order function wrappers." This reverts commit 6634322.
Reviewer's GuideRefactors sample pages to use the reflection-based AttributeTable Type parameter instead of manually-supplied Items collections, and deletes now-unused attribute metadata helpers, simplifying documentation for many components. Updated class diagram for AttributeTable usage in samplesclassDiagram
class AttributeItem {
string Name
string Description
string Type
string ValueList
string DefaultValue
}
class AttributeTable {
+AttributeItem[] Items
+Type Type
}
class DockViews_Index {
-static AttributeItem[] GetAttributes()
-static AttributeItem[] GetDockContentAttributes()
-static AttributeItem[] GetDockComponentAttributes()
}
AttributeTable "*" o-- "*" AttributeItem
DockViews_Index ..> AttributeItem : builds_items_before
DockViews_Index ..> AttributeTable : provides_Items_before
class SampleComponentSkeletons {
}
class SampleComponentDockViews {
}
SampleComponentSkeletons ..> AttributeTable : uses_Type_after
SampleComponentDockViews ..> AttributeTable : uses_Type_after
File-Level Changes
Assessment against linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Now that most
AttributeTableusages have switched to theType-based API, check the remainingGetAttributes()/Get*AttributeItems()helpers (for example inDockViews/Index.razor.cs) and remove any that are no longer referenced to avoid leaving dead code around. - The new
AttributeTable Type=...usages mix fully-qualified types (e.g.typeof(BootstrapBlazor.Components.Console)) and unqualified ones (e.g.typeof(ConsoleMessageItem)); consider standardizing on one style (withusingstatements where needed) to keep the samples consistent and easier to read.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Now that most `AttributeTable` usages have switched to the `Type`-based API, check the remaining `GetAttributes()`/`Get*AttributeItems()` helpers (for example in `DockViews/Index.razor.cs`) and remove any that are no longer referenced to avoid leaving dead code around.
- The new `AttributeTable Type=...` usages mix fully-qualified types (e.g. `typeof(BootstrapBlazor.Components.Console)`) and unqualified ones (e.g. `typeof(ConsoleMessageItem)`); consider standardizing on one style (with `using` statements where needed) to keep the samples consistent and easier to read.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 #7542 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 748 748
Lines 33000 33000
Branches 4588 4588
=========================================
Hits 33000 33000
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.
Pull request overview
This pull request refactors documentation sample pages to use the Type parameter instead of the Items parameter for the AttributeTable component. This change simplifies the code by eliminating the need for manual GetAttributes() methods in many sample files, allowing the AttributeTable component to automatically generate attribute documentation from the component types using reflection.
Changes:
- Replaced
Items="@GetAttributes()"withType="typeof(ComponentName)"across 150+ sample files - Removed manual attribute generation methods from DockViews/Index.razor.cs
- Minor whitespace cleanup (BOM removal and trailing newline normalization)
Reviewed changes
Copilot reviewed 177 out of 177 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| WinBoxes.razor | Updated AttributeTable to use Type parameter for WinBoxOption |
| Watermarks.razor | Added AttributeTable using Type parameter for Watermark |
| VideoPlayers.razor | Updated AttributeTable to use Type parameter for VideoPlayer |
| Vditors.razor | Updated AttributeTable to use Type parameter for Vditor |
| ValidateForms.razor | Updated AttributeTable to use Type parameter for ValidateForm |
| Tabs.razor | Updated AttributeTable to use Type parameter for Tab (with @typeof syntax) |
| Searches.razor | Updated AttributeTable to use Type parameter for Search<> (with @typeof syntax) |
| DockViews/Index.razor | Updated three AttributeTables to use Type parameter |
| DockViews/Index.razor.cs | Removed GetDockContentAttributes() and GetDockComponentAttributes() methods |
| (145+ other files) | Similar refactoring pattern applied consistently |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| </DemoBlock> | ||
|
|
||
| <AttributeTable Items="@GetAttributes()" Title="@Localizer["AttTitle"]" /> | ||
| <AttributeTable Type="@typeof(Tab)" /> |
There was a problem hiding this comment.
Inconsistent use of @typeof() syntax. In Razor files, the @ symbol is not needed within attribute values when using typeof(). The syntax should be Type="typeof(Tab)" not Type="@typeof(Tab)". While both work in Blazor, using @ is redundant within attribute values and inconsistent with the rest of the file changes.
| </DemoBlock> | ||
|
|
||
| <AttributeTable Items="@GetAttributes()" /> | ||
| <AttributeTable Type="@typeof(Search<>)" /> |
There was a problem hiding this comment.
Inconsistent use of @typeof() syntax. In Razor files, the @ symbol is not needed within attribute values when using typeof(). The syntax should be Type="typeof(Search<>)" not Type="@typeof(Search<>)". While both work in Blazor, using @ is redundant within attribute values and inconsistent with the rest of the file changes.
Link issues
fixes #7541
Summary By Copilot
Regression?
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge
Summary by Sourcery
Switch sample component demos to use AttributeTable’s Type-based API instead of manually-supplied attribute lists.
Enhancements: