11using Microsoft . AspNetCore . Components ;
22using Radzen . Blazor . Rendering ;
33using System ;
4- using System . Collections . Generic ;
5- using System . Collections . ObjectModel ;
64using System . Threading . Tasks ;
75namespace Radzen . Blazor ;
86
@@ -11,23 +9,8 @@ namespace Radzen.Blazor;
119/// <summary>
1210/// Represents a table of contents item.
1311/// </summary>
14- public partial class RadzenTocItem : ComponentBase , IAsyncDisposable
12+ public partial class RadzenTocItem : RadzenComponentWithChildren , IAsyncDisposable
1513{
16- /// <summary>
17- /// Gets or sets a dictionary of additional HTML attributes that will be applied to the component's root element.
18- /// Any attributes not explicitly defined as parameters will be captured here and rendered on the element.
19- /// Use this to add data-* attributes, ARIA attributes, or any custom HTML attributes.
20- /// </summary>
21- /// <value>The unmatched attributes dictionary.</value>
22- [ Parameter ( CaptureUnmatchedValues = true ) ]
23- public IReadOnlyDictionary < string , object > Attributes { get ; set ; } = new ReadOnlyDictionary < string , object > ( new Dictionary < string , object > ( ) ) ;
24-
25- /// <summary>
26- /// Gets or sets the child content.
27- /// </summary>
28- [ Parameter ]
29- public RenderFragment ? ChildContent { get ; set ; }
30-
3114 /// <summary>
3215 /// Gets or sets the text displayed in the table of contents.
3316 /// </summary>
@@ -54,25 +37,13 @@ public partial class RadzenTocItem : ComponentBase, IAsyncDisposable
5437
5538 private bool selected ;
5639
57- /// <summary>
58- /// Gets the final CSS class rendered by the component. Combines it with a <c>class</c> custom attribute.
59- /// </summary>
60- protected string GetCssClass ( )
40+ /// <inheritdoc />
41+ protected override string GetComponentCssClass ( )
6142 {
62- if ( Attributes != null && Attributes . TryGetValue ( "class" , out var @class ) && ! string . IsNullOrEmpty ( Convert . ToString ( @class ) ) )
63- {
64- return $ "{ GetComponentCssClass ( ) } { @class } ";
65- }
66-
67- return GetComponentCssClass ( ) ;
68- }
69-
70- /// <summary>
71- /// Gets the component CSS class.
72- /// </summary>
73- protected string GetComponentCssClass ( ) => ClassList . Create ( "rz-toc-item" )
43+ return ClassList . Create ( "rz-toc-item" )
7444 . Add ( "rz-toc-item-selected" , selected )
7545 . ToString ( ) ;
46+ }
7647
7748 private string WrapperClass => ClassList . Create ( "rz-toc-item-wrapper" )
7849 . Add ( Level switch
0 commit comments