Skip to content

Commit 5ff193f

Browse files
authored
Enhance SortableList<TItem> docs and parameter metadata (#1227)
- Update documentation to use TItem instead of object for accuracy. - Add dummy TItem class for documentation purposes. - Improve XML docs for all public parameters, using <para> for defaults. - Add [AddedVersion], [DefaultValue], and [Description] attributes to parameters. - Make ChildContent, Data, DisabledItemCssClass, DisableItem, and EmptyDataTemplate nullable. - Standardize and clarify parameter documentation for better tooling and code analysis support.
1 parent 2d617c0 commit 5ff193f

File tree

2 files changed

+107
-51
lines changed

2 files changed

+107
-51
lines changed

BlazorBootstrap.Demo.RCL/Components/Pages/Docs/SortableList/SortableList_Doc_01_Documentation.razor

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,19 +15,21 @@
1515
</Section>
1616

1717
<Section Class="p-0" Size="HeadingSize.H3" Name="Parameters" PageUrl="@pageUrl" Link="parameters">
18-
<DocxTable TItem="SortableList<object>" DocType="DocType.Parameters" />
18+
<DocxTable TItem="SortableList<TItem>" DocType="DocType.Parameters" />
1919
</Section>
2020

2121
<Section Class="p-0" Size="HeadingSize.H3" Name="Events" PageUrl="@pageUrl" Link="events">
22-
<DocxTable TItem="SortableList<object>" DocType="DocType.Events" />
22+
<DocxTable TItem="SortableList<TItem>" DocType="DocType.Events" />
2323
</Section>
2424

2525
@code {
26-
private const string componentName = nameof(SortableList<object>);
26+
private const string componentName = nameof(SortableList<TItem>);
2727
private const string pageUrl = DemoRouteConstants.Docs_URL_SortableList;
2828
private const string pageTitle = componentName;
2929
private const string pageDescription = $"This documentation provides a comprehensive reference for the <code>{componentName}</code> component, guiding you through its configuration options.";
3030
private const string metaTitle = $"Blazor {componentName} Component";
3131
private const string metaDescription = $"This documentation provides a comprehensive reference for the {componentName} component, guiding you through its configuration options.";
3232
private const string imageUrl = DemoScreenshotSrcConstants.Demos_URL_SortableList;
33-
}
33+
34+
public class TItem : object { }
35+
}

blazorbootstrap/Components/SortableList/SortableList.razor.cs

Lines changed: 101 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -80,151 +80,205 @@ public async Task OnUpdateJS(int oldIndex, int newIndex)
8080

8181
/// <summary>
8282
/// Gets or sets a value indicating whether sorting is allowed for the list.
83+
/// <para>
84+
/// Default value is <see langword="true"/>.
85+
/// </para>
8386
/// </summary>
84-
/// <remarks>
85-
/// Default value is true.
86-
/// </remarks>
87+
[AddedVersion("2.2.0")]
88+
[DefaultValue(true)]
89+
[Description("Gets or sets a value indicating whether sorting is allowed for the list.")]
8790
[Parameter]
8891
public bool AllowSorting { get; set; } = true;
8992

9093
/// <summary>
9194
/// Gets or sets the content to be rendered within the component.
95+
/// <para>
96+
/// Default value is <see langword="null"/>.
97+
/// </para>
9298
/// </summary>
93-
/// <remarks>
94-
/// Default value is null.
95-
/// </remarks>
99+
[AddedVersion("2.2.0")]
100+
[DefaultValue(null)]
101+
[Description("Gets or sets the content to be rendered within the component.")]
96102
[Parameter]
97-
public RenderFragment ChildContent { get; set; } = default!;
103+
public RenderFragment? ChildContent { get; set; }
98104

99105
/// <summary>
100106
/// Gets or sets the items.
107+
/// <para>
108+
/// Default value is <see langword="null"/>.
109+
/// </para>
101110
/// </summary>
102-
/// <remarks>
103-
/// Default value is null.
104-
/// </remarks>
111+
[AddedVersion("2.2.0")]
112+
[DefaultValue(null)]
113+
[Description("Gets or sets the items.")]
105114
[Parameter]
106-
public List<TItem> Data { get; set; } = default!;
115+
public List<TItem>? Data { get; set; }
107116

108117
/// <summary>
109118
/// Gets or sets the CSS class applied to disabled items.
119+
/// <para>
120+
/// Default value is <see langword="null"/>.
121+
/// </para>
110122
/// </summary>
111-
/// <remarks>
112-
/// Default value is null.
113-
/// </remarks>
123+
[AddedVersion("2.2.0")]
124+
[DefaultValue(null)]
125+
[Description("Gets or sets the CSS class applied to disabled items.")]
114126
[Parameter]
115-
public string? DisabledItemCssClass { get; set; } = default!;
127+
public string? DisabledItemCssClass { get; set; }
116128

117129
/// <summary>
118130
/// Gets or sets a delegate that determines whether an item should be disabled.
131+
/// <para>
132+
/// Default value is <see langword="null"/>.
133+
/// </para>
119134
/// </summary>
135+
[AddedVersion("2.2.0")]
136+
[DefaultValue(null)]
137+
[Description("Gets or sets a delegate that determines whether an item should be disabled.")]
120138
[Parameter]
121-
public Func<TItem, bool> DisableItem { get; set; } = default!;
139+
public Func<TItem, bool>? DisableItem { get; set; }
122140

123141
/// <summary>
124142
/// Gets or sets the empty data template.
143+
/// <para>
144+
/// Default value is <see langword="null"/>.
145+
/// </para>
125146
/// </summary>
126-
/// <remarks>
127-
/// Default value is null.
128-
/// </remarks>
147+
[AddedVersion("2.2.0")]
148+
[DefaultValue(null)]
149+
[Description("Gets or sets the empty data template.")]
129150
[Parameter]
130-
public RenderFragment EmptyDataTemplate { get; set; } = default!;
151+
public RenderFragment? EmptyDataTemplate { get; set; }
131152

132153
/// <summary>
133154
/// Gets or sets the text to display when there are no records in the list.
134-
/// </summary>
135-
/// <remarks>
155+
/// <para>
136156
/// Default value is `No records to display`.
137-
/// </remarks>
157+
/// </para>
158+
/// </summary>
159+
[AddedVersion("2.2.0")]
160+
[DefaultValue("No records to display")]
161+
[Description("Gets or sets the text to display when there are no records in the list.")]
138162
[Parameter]
139163
public string EmptyText { get; set; } = "No records to display";
140164

141165
/// <summary>
142166
/// Gets or sets the group name associated with the list.
167+
/// <para>
168+
/// Default value is <see langword="null"/>.
169+
/// </para>
143170
/// </summary>
144-
/// <remarks>
145-
/// Default value is null.
146-
/// </remarks>
171+
[AddedVersion("2.2.0")]
172+
[DefaultValue(null)]
173+
[Description("Gets or sets the group name associated with the list.")]
147174
[Parameter]
148175
public string? Group { get; set; }
149176

150177
/// <summary>
151178
/// Gets or sets the CSS selector for the drag handle element.
179+
/// <para>
180+
/// Default value is <see langword="null"/>.
181+
/// </para>
152182
/// </summary>
153-
/// <remarks>
154-
/// Default value is null.
155-
/// </remarks>
183+
[AddedVersion("2.2.0")]
184+
[DefaultValue(null)]
185+
[Description("Gets or sets the CSS selector for the drag handle element.")]
156186
[Parameter]
157187
public string? Handle { get; set; }
158188

159189
/// <summary>
160190
/// Gets or sets the loading state.
191+
/// <para>
192+
/// Default value is <see langword="false"/>.
193+
/// </para>
161194
/// </summary>
162-
/// <remarks>
163-
/// Default value is false.
164-
/// </remarks>
195+
[AddedVersion("2.2.0")]
196+
[DefaultValue(false)]
197+
[Description("Gets or sets the loading state.")]
165198
[Parameter]
166199
public bool IsLoading { get; set; }
167200

168201
/// <summary>
169202
/// Gets or sets the template used to render individual items in the list.
203+
/// <para>
204+
/// Default value is <see langword="null"/>.
205+
/// </para>
170206
/// </summary>
171-
/// <remarks>
172-
/// Default value is null.
173-
/// </remarks>
207+
[AddedVersion("2.2.0")]
208+
[DefaultValue(null)]
209+
[Description("Gets or sets the template used to render individual items in the list.")]
174210
[Parameter]
175211
public RenderFragment<TItem>? ItemTemplate { get; set; }
176212

177213
/// <summary>
178214
/// Gets or sets the loading template.
215+
/// <para>
216+
/// Default value is <see langword="null"/>.
217+
/// </para>
179218
/// </summary>
180-
/// <remarks>
181-
/// Default value is null.
182-
/// </remarks>
219+
[AddedVersion("2.2.0")]
220+
[DefaultValue(null)]
221+
[Description("Gets or sets the loading template.")]
183222
[Parameter]
184223
public RenderFragment LoadingTemplate { get; set; } = default!;
185224

186225
/// <summary>
187226
/// Gets or sets the name of the <see cref="SortableList{TItem}" /> component.
227+
/// <para>
228+
/// Default value is <see langword="null"/>.
229+
/// </para>
188230
/// </summary>
189-
/// <remarks>
190-
/// Default value is null.
191-
/// </remarks>
231+
[AddedVersion("2.2.0")]
232+
[DefaultValue(null)]
233+
[Description("Gets or sets the name of the <b>SortableList{TItem}</b> component.")]
192234
[Parameter]
193235
public string? Name { get; set; }
194236

195237
/// <summary>
196238
/// Gets or sets an event callback that fires when an item is added to the list.
197239
/// </summary>
240+
[AddedVersion("2.2.0")]
241+
[Description("Gets or sets an event callback that fires when an item is added to the list.")]
198242
[Parameter]
199243
public EventCallback<SortableListEventArgs> OnAdd { get; set; }
200244

201245
/// <summary>
202246
/// Gets or sets an event callback that fires when an item is removed from the list.
203247
/// </summary>
248+
[AddedVersion("2.2.0")]
249+
[Description("Gets or sets an event callback that fires when an item is removed from the list.")]
204250
[Parameter]
205251
public EventCallback<SortableListEventArgs> OnRemove { get; set; }
206252

207253
/// <summary>
208254
/// Gets or sets an event callback that fires when an item is updated in the list.
209255
/// </summary>
256+
[AddedVersion("2.2.0")]
257+
[Description("Gets or sets an event callback that fires when an item is updated in the list.")]
210258
[Parameter]
211259
public EventCallback<SortableListEventArgs> OnUpdate { get; set; }
212260

213261
/// <summary>
214262
/// Gets or sets the pull mode for the sortable list.
215-
/// </summary>
216-
/// <remarks>
263+
/// <para>
217264
/// Default value is <see cref="SortableListPullMode.True" />.
218-
/// </remarks>
265+
/// </para>
266+
/// </summary>
267+
[AddedVersion("2.2.0")]
268+
[DefaultValue(SortableListPullMode.True)]
269+
[Description("Gets or sets the pull mode for the sortable list.")]
219270
[Parameter]
220271
public SortableListPullMode Pull { get; set; } = SortableListPullMode.True;
221272

222273
/// <summary>
223274
/// Gets or sets the put mode for the sortable list.
224-
/// </summary>
225-
/// <remarks>
275+
/// <para>
226276
/// Default value is <see cref="SortableListPutMode.True" />.
227-
/// </remarks>
277+
/// </para>
278+
/// </summary>
279+
[AddedVersion("2.2.0")]
280+
[DefaultValue(SortableListPutMode.True)]
281+
[Description("Gets or sets the put mode for the sortable list.")]
228282
[Parameter]
229283
public SortableListPutMode Put { get; set; } = SortableListPutMode.True;
230284

0 commit comments

Comments
 (0)