diff --git a/BlazorBootstrap.Demo.RCL/Components/Pages/Docs/Grid/Grid_Doc_01_Documentation.razor b/BlazorBootstrap.Demo.RCL/Components/Pages/Docs/Grid/Grid_Doc_01_Documentation.razor index 16d01abfb..1c17fb02c 100644 --- a/BlazorBootstrap.Demo.RCL/Components/Pages/Docs/Grid/Grid_Doc_01_Documentation.razor +++ b/BlazorBootstrap.Demo.RCL/Components/Pages/Docs/Grid/Grid_Doc_01_Documentation.razor @@ -15,19 +15,19 @@
- +
- +
- +
-
- +
+
@@ -35,23 +35,35 @@
- +
- +
-
- +
+ +
+ +
+ +
+ +
+
@code { - private const string componentName = nameof(Grid); + private const string componentName = nameof(Grid); private const string pageUrl = DemoRouteConstants.Docs_URL_Grid; private const string pageTitle = componentName; private const string pageDescription = $"This documentation provides a comprehensive reference for the {componentName} component, guiding you through its configuration options."; private const string metaTitle = $"Blazor {componentName} Component"; private const string metaDescription = $"This documentation provides a comprehensive reference for the {componentName} component, guiding you through its configuration options."; private const string imageUrl = DemoScreenshotSrcConstants.Demos_URL_Grid_Overview; + + public class TItem : object + { + } } \ No newline at end of file diff --git a/BlazorBootstrap.Demo.RCL/Constants/DemoScreenshotSrcConstants.cs b/BlazorBootstrap.Demo.RCL/Constants/DemoScreenshotSrcConstants.cs index dbcf8be79..ddfd69234 100644 --- a/BlazorBootstrap.Demo.RCL/Constants/DemoScreenshotSrcConstants.cs +++ b/BlazorBootstrap.Demo.RCL/Constants/DemoScreenshotSrcConstants.cs @@ -50,15 +50,15 @@ public class DemoScreenshotSrcConstants #region Grid public const string Demos_URL_Grid_Prefix = DemoScreenshotSrcPrefix + "grid.png"; - public const string Demos_URL_Grid_Overview = DemoScreenshotSrcPrefix + "home.png"; + public const string Demos_URL_Grid_Overview = DemoScreenshotSrcPrefix + "grid_fixed_header_freeze_columns.png"; public const string Demos_URL_Grid_Alignment = DemoScreenshotSrcPrefix + "home.png"; public const string Demos_URL_Grid_CustomCSSClass = DemoScreenshotSrcPrefix + "home.png"; public const string Demos_URL_Grid_DataBinding = DemoScreenshotSrcPrefix + "home.png"; public const string Demos_URL_Grid_DetailView = DemoScreenshotSrcPrefix + "home.png"; public const string Demos_URL_Grid_Events = DemoScreenshotSrcPrefix + "home.png"; public const string Demos_URL_Grid_Filters = DemoScreenshotSrcPrefix + "home.png"; - public const string Demos_URL_Grid_FixedHeader = DemoScreenshotSrcPrefix + "home.png"; - public const string Demos_URL_Grid_FreezeColumns = DemoScreenshotSrcPrefix + "home.png"; + public const string Demos_URL_Grid_FixedHeader = DemoScreenshotSrcPrefix + "grid_fixed_header_freeze_columns.png"; + public const string Demos_URL_Grid_FreezeColumns = DemoScreenshotSrcPrefix + "grid_fixed_header_freeze_columns.png"; public const string Demos_URL_Grid_Settings = DemoScreenshotSrcPrefix + "home.png"; public const string Demos_URL_Grid_NestedGrid = DemoScreenshotSrcPrefix + "home.png"; public const string Demos_URL_Grid_Paging = DemoScreenshotSrcPrefix + "home.png"; diff --git a/BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/grid_detail_view.png b/BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/grid_detail_view.png new file mode 100644 index 000000000..1cb9b96fb Binary files /dev/null and b/BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/grid_detail_view.png differ diff --git a/BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/grid_fixed_header_freeze_columns.png b/BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/grid_fixed_header_freeze_columns.png new file mode 100644 index 000000000..a81ce0b07 Binary files /dev/null and b/BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/grid_fixed_header_freeze_columns.png differ diff --git a/BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/grid_nested_grid.png b/BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/grid_nested_grid.png new file mode 100644 index 000000000..0a16e7d3c Binary files /dev/null and b/BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/grid_nested_grid.png differ diff --git a/BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/grid_translations.png b/BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/grid_translations.png new file mode 100644 index 000000000..bdba45fef Binary files /dev/null and b/BlazorBootstrap.Demo.RCL/wwwroot/images/screenshots/grid_translations.png differ diff --git a/blazorbootstrap/Components/Core/BlazorBootstrapComponentBase.cs b/blazorbootstrap/Components/Core/BlazorBootstrapComponentBase.cs index 142150f2b..87dc2375e 100644 --- a/blazorbootstrap/Components/Core/BlazorBootstrapComponentBase.cs +++ b/blazorbootstrap/Components/Core/BlazorBootstrapComponentBase.cs @@ -148,7 +148,7 @@ protected virtual ValueTask DisposeAsyncCore(bool disposing) [Description("Gets or sets additional attributes that will be applied to the component.")] [ParameterTypeName("Dictionary")] [Parameter(CaptureUnmatchedValues = true)] - public Dictionary AdditionalAttributes { get; set; } = default!; + public Dictionary? AdditionalAttributes { get; set; } /// /// Gets or sets the CSS class name(s) to apply to the component. diff --git a/blazorbootstrap/Components/Core/BlazorBootstrapLayoutComponentBase.cs b/blazorbootstrap/Components/Core/BlazorBootstrapLayoutComponentBase.cs index e38db58bc..c09e8b672 100644 --- a/blazorbootstrap/Components/Core/BlazorBootstrapLayoutComponentBase.cs +++ b/blazorbootstrap/Components/Core/BlazorBootstrapLayoutComponentBase.cs @@ -141,7 +141,7 @@ protected virtual ValueTask DisposeAsyncCore(bool disposing) [Description("Gets or sets additional attributes that will be applied to the component.")] [Parameter(CaptureUnmatchedValues = true)] [ParameterTypeName("Dictionary")] - public Dictionary AdditionalAttributes { get; set; } = default!; + public Dictionary? AdditionalAttributes { get; set; } /// /// Gets or sets the CSS class name(s) to apply to the component. diff --git a/blazorbootstrap/Components/Grid/Grid.razor.cs b/blazorbootstrap/Components/Grid/Grid.razor.cs index e4ce77f84..331e101e8 100644 --- a/blazorbootstrap/Components/Grid/Grid.razor.cs +++ b/blazorbootstrap/Components/Grid/Grid.razor.cs @@ -116,12 +116,14 @@ protected override Task OnParametersSetAsync() /// Get filters. /// /// IEnumerable + [AddedVersion("1.0.0")] + [Description("Get filters.")] public IEnumerable? GetFilters() => !AllowFiltering || columns == null || !columns.Any() ? null : columns .Where(column => column.Filterable && column.GetFilterOperator() != FilterOperator.None && !string.IsNullOrWhiteSpace(column.GetFilterValue())) - ?.Select(column => new FilterItem(column.PropertyName, column.GetFilterValue(), column.GetFilterOperator(), column.StringComparison)); + ?.Select(column => new FilterItem(column.PropertyName!, column.GetFilterValue(), column.GetFilterOperator(), column.StringComparison)); private string GetColumnSummaryValue(GridSummaryColumnType type, string propertyName, string format, string prefix) { @@ -130,27 +132,27 @@ private string GetColumnSummaryValue(GridSummaryColumnType type, string property if (type == GridSummaryColumnType.Average) { prefix ??= "Avg: "; - value = items?.Average(x => Convert.ToDouble(x.GetType().GetProperty(propertyName)?.GetValue(x))) ?? 0; + value = items?.Average(x => Convert.ToDouble(x?.GetType().GetProperty(propertyName)?.GetValue(x))) ?? 0; } else if (type == GridSummaryColumnType.Count) { prefix ??= "Count: "; - value = items?.Where(x => x.GetType().GetProperty(propertyName)?.GetValue(x) is not null).Count() ?? 0; + value = items?.Where(x => x?.GetType().GetProperty(propertyName)?.GetValue(x) is not null).Count() ?? 0; } else if (type == GridSummaryColumnType.Max) { prefix ??= "Max: "; - value = items?.Max(x => Convert.ToDouble(x.GetType().GetProperty(propertyName)?.GetValue(x))) ?? 0; + value = items?.Max(x => Convert.ToDouble(x?.GetType().GetProperty(propertyName)?.GetValue(x))) ?? 0; } else if (type == GridSummaryColumnType.Min) { prefix ??= "Min: "; - value = items?.Min(x => Convert.ToDouble(x.GetType().GetProperty(propertyName)?.GetValue(x))) ?? 0; + value = items?.Min(x => Convert.ToDouble(x?.GetType().GetProperty(propertyName)?.GetValue(x))) ?? 0; } else if (type == GridSummaryColumnType.Sum) { prefix ??= "Total: "; - value = items?.Sum(x => Convert.ToDouble(x.GetType().GetProperty(propertyName)?.GetValue(x))) ?? 0; + value = items?.Sum(x => Convert.ToDouble(x?.GetType().GetProperty(propertyName)?.GetValue(x))) ?? 0; } if (string.IsNullOrWhiteSpace(format)) @@ -163,15 +165,33 @@ private string GetColumnSummaryValue(GridSummaryColumnType type, string property /// Refresh the grid data. /// /// Task + [AddedVersion("1.0.0")] + [Description("Refresh the grid data.")] public async Task RefreshDataAsync(CancellationToken cancellationToken = default) => await RefreshDataAsync(false, cancellationToken); /// /// Reset the page number to 1 and refresh the grid. /// + [AddedVersion("1.4.3")] + [Description("Reset the page number to 1 and refresh the grid.")] public async ValueTask ResetPageNumber() => await ResetPageNumberAsync(true); + /// + /// Selects all items in the grid asynchronously. + /// + /// A task that represents the asynchronous operation. The task completes when all items have been selected. + [AddedVersion("1.8.0")] + [Description("Selects all items in the grid asynchronously.")] public Task SelectAllItemsAsync() => SelectAllItemsInternalAsync(true); + /// + /// Asynchronously clears the selection of all items in the grid. + /// + /// This method can be awaited to ensure that all items are unselected before proceeding with + /// further actions. If no items are currently selected, the operation completes without effect. + /// A task that represents the asynchronous operation of deselecting all items. + [AddedVersion("1.8.0")] + [Description("Asynchronously clears the selection of all items in the grid.")] public Task UnSelectAllItemsAsync() => SelectAllItemsInternalAsync(false); internal void AddColumn(GridColumn column) => columns.Add(column); @@ -651,55 +671,73 @@ private void SetFilters(IEnumerable filterItems) /// /// Gets or sets a value indicating whether the grid detail view is enabled. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("3.0.0")] + [DefaultValue(false)] + [Description("Gets or sets a value indicating whether the grid detail view is enabled.")] [Parameter] public bool AllowDetailView { get; set; } /// /// Gets or sets the grid filtering. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.0.0")] + [DefaultValue(false)] + [Description("Gets or sets the grid filtering.")] [Parameter] public bool AllowFiltering { get; set; } /// /// Gets or sets the grid paging. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.0.0")] + [DefaultValue(false)] + [Description("Gets or sets the grid paging.")] [Parameter] public bool AllowPaging { get; set; } /// /// Gets or sets the allow row click. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.9.5")] + [DefaultValue(false)] + [Description("Gets or sets the allow row click.")] [Parameter] public bool AllowRowClick { get; set; } /// /// Gets or sets the grid selection. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.8.0")] + [DefaultValue(false)] + [Description("Gets or sets the grid selection.")] [Parameter] public bool AllowSelection { get; set; } /// /// Gets or sets the grid sorting. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.0.0")] + [DefaultValue(false)] + [Description("Gets or sets the grid sorting.")] [Parameter] public bool AllowSorting { get; set; } @@ -709,108 +747,157 @@ private void SetFilters(IEnumerable filterItems) /// Default value is . /// /// + [AddedVersion("1.0.0")] + [DefaultValue(false)] + [Description("Gets or sets the grid summary.")] [Parameter] public bool AllowSummary { get; set; } /// /// Automatically hides the paging controls when the grid item count is less than or equal to the /// and this property is set to `true`. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.10.5")] + [DefaultValue(false)] + [Description("Automatically hides the paging controls when the grid item count is less than or equal to the PageSize and this property is set to true.")] [Parameter] public bool AutoHidePaging { get; set; } /// /// Gets or sets the content to be rendered within the component. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the content to be rendered within the component.")] + [EditorRequired] [Parameter] - public RenderFragment ChildContent { get; set; } = default!; + public RenderFragment? ChildContent { get; set; } /// /// Gets or sets the grid data. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.4.3")] + [DefaultValue(null)] + [Description("Gets or sets the grid data.")] [Parameter] - public IEnumerable Data { get; set; } = default!; + public IEnumerable? Data { get; set; } /// /// DataProvider is for items to render. - /// The provider should always return an instance of 'GridDataProviderResult', and 'null' is not allowed. + /// The provider should always return an instance of , and is not allowed. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("DataProvider is for items to render. The provider should always return an instance of GridDataProviderResult, and null is not allowed.")] [Parameter] - public GridDataProviderDelegate DataProvider { get; set; } = default!; + public GridDataProviderDelegate? DataProvider { get; set; } /// /// Enable or disable the header checkbox selection. + /// + /// Default value is . + /// /// + [AddedVersion("1.8.0")] + [DefaultValue(null)] + [Description("Enable or disable the header checkbox selection.")] [Parameter] public Func, bool>? DisableAllRowsSelection { get; set; } /// /// Enable or disable the row level checkbox selection. + /// + /// Default value is . + /// /// + [AddedVersion("1.8.0")] + [DefaultValue(null)] + [Description("Enable or disable the row level checkbox selection.")] [Parameter] public Func? DisableRowSelection { get; set; } /// /// Gets or sets the empty text. /// Shows text on no records. - /// - /// + /// /// Default value is 'No records to display'. - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue("No records to display")] + [Description("Gets or sets the empty text. Shows text on no records.")] [Parameter] public string EmptyText { get; set; } = "No records to display"; /// /// Gets or sets the enum filter select text. - /// - /// + /// /// Default value is 'Select'. - /// + /// + /// + [AddedVersion("3.1.0")] + [DefaultValue("Select")] + [Description("Gets or sets the enum filter select text.")] [Parameter] - public string? EnumFilterSelectText { get; set; } = "Select"; + public string EnumFilterSelectText { get; set; } = "Select"; /// /// Gets or sets the filters row css class. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.9.2")] + [DefaultValue(null)] + [Description("Gets or sets the filters row css class.")] [Parameter] - public string FiltersRowCssClass { get; set; } = default!; + public string? FiltersRowCssClass { get; set; } /// /// Gets or sets the filters translation provider. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.10.0")] + [DefaultValue(null)] + [Description("Gets or sets the filters translation provider.")] [Parameter] - public GridFiltersTranslationDelegate FiltersTranslationProvider { get; set; } = default!; + public GridFiltersTranslationDelegate? FiltersTranslationProvider { get; set; } /// /// Gets or sets the grid fixed header. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.10.3")] + [DefaultValue(false)] + [Description("Gets or sets the grid fixed header.")] [Parameter] public bool FixedHeader { get; set; } /// /// Gets or sets the grid container css class. + /// + /// Default value is . + /// /// + [AddedVersion("3.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the grid container css class.")] [Parameter] public string? GridContainerClass { get; set; } @@ -822,7 +909,13 @@ private void SetFilters(IEnumerable filterItems) /// /// Gets or sets the grid container css style. + /// + /// Default value is . + /// /// + [AddedVersion("3.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the grid container css style.")] [Parameter] public string? GridContainerStyle { get; set; } @@ -836,17 +929,22 @@ private void SetFilters(IEnumerable filterItems) /// /// This event is fired when the grid state is changed. /// + [AddedVersion("1.0.0")] + [Description("This event is fired when the grid state is changed.")] [Parameter] public EventCallback GridSettingsChanged { get; set; } /// /// Gets or sets the header row css class but not the thead tag class. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.9.2")] + [DefaultValue(null)] + [Description("Gets or sets the header row css class but not the thead tag class.")] [Parameter] - public string HeaderRowCssClass { get; set; } = default!; + public string? HeaderRowCssClass { get; set; } /// /// Header selection template. @@ -891,21 +989,26 @@ private void SetFilters(IEnumerable filterItems) /// /// Gets or sets the grid height. - /// - /// + /// /// Default value is 320 . - /// + /// + /// + [AddedVersion("1.10.3")] + [DefaultValue(320)] + [Description("Gets or sets the grid height.")] [Parameter] public float Height { get; set; } = 320; /// /// Gets or sets the items per page text. - /// - /// + /// /// Default value is 'Items per page'. - /// + /// + /// + [AddedVersion("1.9.5")] + [DefaultValue("Items per page")] + [Description("Gets or sets the items per page text.")] [Parameter] - //[EditorRequired] public string ItemsPerPageText { get; set; } = "Items per page"!; /// @@ -914,6 +1017,9 @@ private void SetFilters(IEnumerable filterItems) /// Default value is . /// /// + [AddedVersion("3.4.0")] + [DefaultValue(null)] + [Description("Gets or sets the locale.")] [Parameter] public string? Locale { get; set; } @@ -921,6 +1027,8 @@ private void SetFilters(IEnumerable filterItems) /// This event is triggered when the user clicks on the row. /// Set AllowRowClick to true to enable row clicking. /// + [AddedVersion("1.9.5")] + [Description("This event is triggered when the user clicks on the row. Set AllowRowClick to true to enable row clicking.")] [Parameter] public EventCallback> OnRowClick { get; set; } @@ -928,123 +1036,154 @@ private void SetFilters(IEnumerable filterItems) /// This event is triggered when the user double clicks on the row. /// Set AllowRowClick to true to enable row double clicking. /// + [AddedVersion("1.9.5")] + [Description("This event is triggered when the user double clicks on the row. Set AllowRowClick to true to enable row double clicking.")] [Parameter] public EventCallback> OnRowDoubleClick { get; set; } /// /// Gets or sets the page size. - /// - /// + /// /// Default value is 10. - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(10)] + [Description("Gets or sets the page size.")] [Parameter] public int PageSize { get; set; } = 10; /// /// Gets or sets the page size selector items. - /// - /// + /// /// Default value is '{ 10, 20, 50 }'. - /// + /// + /// + [AddedVersion("1.8.0")] + [DefaultValue(new int[] { 10, 20, 50 })] + [Description("Gets or sets the page size selector items.")] [Parameter] - //[EditorRequired] public int[] PageSizeSelectorItems { get; set; } = { 10, 20, 50 }; /// /// Gets or sets the page size selector visible. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.8.0")] + [DefaultValue(false)] + [Description("Gets or sets the page size selector visible.")] [Parameter] public bool PageSizeSelectorVisible { get; set; } - [Obsolete("PaginationAlignment parameter is not supported from 1.8.0 version onwards")] - /// - /// Gets or sets the pagination alignment. - /// - /// - /// Default value is . - /// - [Parameter] - public Alignment PaginationAlignment { get; set; } = Alignment.Start; - private string paginationItemsText => GetPaginationItemsText(); /// /// Gets or sets the pagination items text format. - /// - /// + /// /// Default value is '{0} - {1} of {2} items'. - /// + /// + /// + [AddedVersion("1.8.0")] + [DefaultValue("{0} - {1} of {2} items")] + [Description("Gets or sets the pagination items text format.")] [Parameter] - //[EditorRequired] public string PaginationItemsTextFormat { get; set; } = "{0} - {1} of {2} items"!; /// /// Gets or sets a value indicating whether the grid is responsive. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.0.0")] + [DefaultValue(false)] + [Description("Gets or sets a value indicating whether the grid is responsive.")] [Parameter] public bool Responsive { get; set; } /// /// Gets or sets the row class. + /// + /// Default value is . + /// /// + [AddedVersion("1.6.0")] + [DefaultValue(null)] + [Description("Gets or sets the row class.")] [Parameter] public Func? RowClass { get; set; } /// /// Gets or sets the function used to extract a unique key from a row item. - /// - /// + /// /// The key returned by the function is used to uniquely identify each row in the data set. This /// is typically required for operations such as tracking changes or rendering rows efficiently. /// If not set, the item hash code will be used as the key. /// Example usage: `RowKeySelector="(employee) => employee.Id"`. - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the function used to extract a unique key from a row item.")] [Parameter] public Func? RowKeySelector { get; set; } - + /// /// Gets or sets the selected items. + /// + /// Default value is . + /// /// + [AddedVersion("1.8.0")] + [DefaultValue(null)] + [Description("Gets or sets the selected items.")] [Parameter] public HashSet? SelectedItems { get; set; } /// /// This event is fired when the item selection changes. /// + [AddedVersion("1.8.0")] + [Description("This event is fired when the item selection changes.")] [Parameter] public EventCallback> SelectedItemsChanged { get; set; } /// /// Gets or sets the grid selection mode. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("1.8.0")] + [DefaultValue(GridSelectionMode.Single)] + [Description("Gets or sets the grid selection mode.")] [Parameter] public GridSelectionMode SelectionMode { get; set; } = GridSelectionMode.Single; /// /// Settings is for grid to render. - /// The provider should always return an instance of 'GridSettings', and 'null' is not allowed. + /// The provider should always return an instance of , and is not allowed. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Settings is for grid to render. The provider should always return an instance of GridSettings, and null is not allowed.")] [Parameter] - public GridSettingsProviderDelegate SettingsProvider { get; set; } = default!; + public GridSettingsProviderDelegate? SettingsProvider { get; set; } /// /// Gets or sets the thead css class. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.10.3")] + [DefaultValue(null)] + [Description("Gets or sets the thead css class.")] [Parameter] public string? THeadCssClass { get; set; } @@ -1052,10 +1191,13 @@ private void SetFilters(IEnumerable filterItems) /// /// Gets or sets the units. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("1.10.3")] + [DefaultValue(null)] + [Description("Gets or sets the units.")] [Parameter] public Unit Unit { get; set; } = Unit.Px; diff --git a/blazorbootstrap/Components/Grid/GridColumn.razor.cs b/blazorbootstrap/Components/Grid/GridColumn.razor.cs index 0c82529b4..3c15c53ec 100644 --- a/blazorbootstrap/Components/Grid/GridColumn.razor.cs +++ b/blazorbootstrap/Components/Grid/GridColumn.razor.cs @@ -27,7 +27,7 @@ protected override async Task OnInitializedAsync() Id = IdUtility.GetNextId(); // Required filterOperator = FilterOperator; - filterValue = FilterValue; + filterValue = FilterValue!; currentSortDirection = SortDirection; defaultSortDirection = SortDirection; @@ -48,16 +48,16 @@ protected override async Task OnInitializedAsync() internal string GetFilterValue() => filterValue; - internal Type GetPropertyType() => typeof(TItem).GetPropertyType(PropertyName)!; + internal Type GetPropertyType() => typeof(TItem).GetPropertyType(PropertyName!)!; - internal string GetPropertyTypeName() => typeof(TItem).GetPropertyTypeName(PropertyName); + internal string GetPropertyTypeName() => typeof(TItem).GetPropertyTypeName(PropertyName!); internal IEnumerable> GetSorting() { if (SortKeySelector == null && string.IsNullOrWhiteSpace(SortString)) yield break; - yield return new SortingItem(SortString, SortKeySelector!, currentSortDirection); + yield return new SortingItem(SortString!, SortKeySelector!, currentSortDirection); } internal async Task OnFilterChangedAsync(FilterEventArgs args, GridColumn column) @@ -196,134 +196,180 @@ private async Task OnSortClickAsync() /// /// Specifies the content to be rendered inside the grid column. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Specifies the content to be rendered inside the grid column.")] + [EditorRequired] [Parameter] - public RenderFragment ChildContent { get; set; } = default!; + public RenderFragment? ChildContent { get; set; } /// /// Gets or sets the column class. + /// + /// Default value is . + /// /// + [AddedVersion("1.6.0")] + [DefaultValue(null)] + [Description("Gets or sets the column class.")] [Parameter] public Func? ColumnClass { get; set; } /// /// If , filter is enabled. /// The filter is enabled or disabled based on the grid `AllowFiltering` parameter. + /// + /// Default value is . + /// /// - /// - /// Default value is true. - /// + [AddedVersion("1.0.0")] + [DefaultValue(true)] + [Description("If true, filter is enabled. The filter is enabled or disabled based on the grid AllowFiltering parameter.")] [Parameter] public bool Filterable { get; set; } = true; /// /// Gets or sets the filter button color. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("3.0.0")] + [DefaultValue(ButtonColor.Light)] + [Description("Gets or sets the filter button color.")] [Parameter] public ButtonColor FilterButtonColor { get; set; } = ButtonColor.Light; /// /// Gets or sets the filter button CSS class. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("3.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the filter button CSS class.")] [Parameter] public string? FilterButtonCSSClass { get; set; } /// /// Gets or sets the filter operator. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(FilterOperator.None)] + [Description("Gets or sets the filter operator.")] [Parameter] public FilterOperator FilterOperator { get; set; } = FilterOperator.None; /// /// Gets or sets the filter textbox width in pixels. - /// - /// + /// /// Default value is 0. - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(0)] + [Description("Gets or sets the filter textbox width in pixels.")] [Parameter] public int FilterTextboxWidth { get; set; } /// /// Gets or sets the filter textbox width units. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(Unit.Px)] + [Description("Gets or sets the filter textbox width units.")] [Parameter] public Unit FilterTextboxWidthUnit { get; set; } = Unit.Px; /// /// Gets or sets the filter value. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the filter value.")] [Parameter] - public string FilterValue { get; set; } = default!; + public string? FilterValue { get; set; } /// /// Indicates whether the column is frozen. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.10.4")] + [DefaultValue(false)] + [Description("Indicates whether the column is frozen.")] [Parameter] public bool Freeze { get; set; } /// /// Gets or sets the freeze direction of the column. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("1.10.4")] + [DefaultValue(FreezeDirection.Left)] + [Description("Gets or sets the freeze direction of the column.")] [Parameter] public FreezeDirection FreezeDirection { get; set; } = FreezeDirection.Left; /// /// Gets or sets the horizontal position of the column from left. It has no effect on non-positioned columns. - /// - /// + /// /// Default value is 0. - /// + /// + /// + [AddedVersion("1.10.4")] + [DefaultValue(0)] + [Description("Gets or sets the horizontal position of the column from left. It has no effect on non-positioned columns.")] [Parameter] public double FreezeLeftPosition { get; set; } /// /// Gets or sets the horizontal position of the column from right. It has no effect on non-positioned columns. - /// - /// + /// /// Default value is 0. - /// + /// + /// + [AddedVersion("1.10.4")] + [DefaultValue(0)] + [Description("Gets or sets the horizontal position of the column from right. It has no effect on non-positioned columns.")] [Parameter] public double FreezeRightPosition { get; set; } /// /// Gets or sets the header content. /// - /// - /// Default value is null. - /// + /// + /// Default value is . + /// + [AddedVersion("1.7.3")] + [DefaultValue(null)] + [Description("Gets or sets the header content.")] [Parameter] - public RenderFragment HeaderContent { get; set; } = default!; + public RenderFragment? HeaderContent { get; set; } /// /// Gets or sets the header template. /// - /// + /// /// Default value is null. - /// + /// internal RenderFragment HeaderTemplate => headerTemplate ??= builder => { @@ -402,37 +448,49 @@ private async Task OnSortClickAsync() /// /// Gets or sets the table column header text. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the table column header text.")] [Parameter] - public string HeaderText { get; set; } = default!; + public string? HeaderText { get; set; } /// /// Gets or sets the header text alignment. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(Alignment.Start)] + [Description("Gets or sets the header text alignment.")] [Parameter] public Alignment HeaderTextAlignment { get; set; } = Alignment.Start; /// /// Gets or sets the default sort column. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.0.0")] + [DefaultValue(false)] + [Description("Gets or sets the default sort column.")] [Parameter] - public bool IsDefaultSortColumn { get; set; } = false; + public bool IsDefaultSortColumn { get; set; } /// /// Gets or sets visibility of the Grid column. + /// + /// Default value is . + /// /// - /// - /// Default value is true. - /// + [AddedVersion("3.4.0")] + [DefaultValue(true)] + [Description("Gets or sets visibility of the Grid column.")] [Parameter] public bool IsVisible { get; set; } = true; @@ -442,55 +500,76 @@ private async Task OnSortClickAsync() /// /// Gets or sets the property name. /// This is required when `AllowFiltering` is true. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the property name. This is required when AllowFiltering is true.")] [Parameter] - public string PropertyName { get; set; } = default!; + public string? PropertyName { get; set; } /// /// Enable or disable the sorting on a specific column. /// The sorting is enabled or disabled based on the `AllowSorting` parameter on the grid. + /// + /// Default value is . + /// /// - /// - /// Default value is true. - /// + [AddedVersion("1.0.0")] + [DefaultValue(true)] + [Description("Enable or disable the sorting on a specific column. The sorting is enabled or disabled based on the AllowSorting parameter on the grid.")] [Parameter] public bool Sortable { get; set; } = true; /// /// Gets or sets the default sort direction of a column. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(SortDirection.None)] + [Description("Gets or sets the default sort direction of a column.")] [Parameter] public SortDirection SortDirection { get; set; } = SortDirection.None; /// /// Expression used for sorting. + /// + /// Default value is . + /// /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Expression used for sorting.")] [Parameter] - public Expression> SortKeySelector { get; set; } = default!; + public Expression>? SortKeySelector { get; set; } /// /// Gets or sets the column sort string. /// This value will be passed to the backend/API for sorting. /// And this property is ignored for the client-side sorting. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Gets or sets the column sort string. This value will be passed to the backend/API for sorting. And this property is ignored for the client-side sorting.")] [Parameter] - public string SortString { get; set; } = default!; + public string? SortString { get; set; } /// /// Gets or sets the StringComparison. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(StringComparison.OrdinalIgnoreCase)] + [Description("Gets or sets the StringComparison.")] [Parameter] public StringComparison StringComparison { get; set; } = StringComparison.OrdinalIgnoreCase; @@ -500,6 +579,9 @@ private async Task OnSortClickAsync() /// Default value is . /// /// + [AddedVersion("3.4.0")] + [DefaultValue(GridSummaryColumnType.None)] + [Description("Gets or sets the summary column type.")] [Parameter] public GridSummaryColumnType SummaryType { get; set; } = GridSummaryColumnType.None; @@ -509,6 +591,9 @@ private async Task OnSortClickAsync() /// Default value is . /// /// + [AddedVersion("3.4.0")] + [DefaultValue(null)] + [Description("Gets or sets the summary value display format.")] [Parameter] public string? SummaryValueDisplayFormat { get; set; } @@ -520,24 +605,33 @@ private async Task OnSortClickAsync() /// Example: "Total: ", "Average: ", etc. /// /// + [AddedVersion("3.4.0")] + [DefaultValue(null)] + [Description("Gets or sets the summary value prefix. If set, it will be displayed before the summary value. Otherwise, based on the SummaryType, default prefix will be displayed. To remove the default prefix, set this property to an empty string.")] [Parameter] public string? SummaryValuePrefix { get; set; } /// /// Gets or sets the text alignment. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("1.0.0")] + [DefaultValue(Alignment.Start)] + [Description("Gets or sets the text alignment.")] [Parameter] public Alignment TextAlignment { get; set; } = Alignment.Start; /// /// Gets or sets text nowrap. + /// + /// Default value is . + /// /// - /// - /// Default value is false. - /// + [AddedVersion("1.0.0")] + [DefaultValue(false)] + [Description("Gets or sets text nowrap.")] [Parameter] public bool TextNoWrap { get; set; } diff --git a/blazorbootstrap/Components/Grid/GridColumnFilter.razor.cs b/blazorbootstrap/Components/Grid/GridColumnFilter.razor.cs index f7685aadd..769766487 100644 --- a/blazorbootstrap/Components/Grid/GridColumnFilter.razor.cs +++ b/blazorbootstrap/Components/Grid/GridColumnFilter.razor.cs @@ -153,18 +153,18 @@ or StringConstants.PropertyTypeNameDecimal /// /// Gets or sets the filter button color. /// - /// + /// /// Default value is . - /// + /// [Parameter] public ButtonColor FilterButtonColor { get; set; } = ButtonColor.Light; /// /// Gets or sets the filter button CSS class. /// - /// + /// /// Default value is null. - /// + /// [Parameter] public string? FilterButtonCSSClass { get; set; } @@ -188,9 +188,9 @@ or StringConstants.PropertyTypeNameDecimal /// /// Gets or sets filter value. /// - /// + /// /// Default value is null. - /// + /// [Parameter] public string? FilterValue { get; set; } @@ -217,9 +217,9 @@ or StringConstants.PropertyTypeNameDecimal /// /// Gets or sets the filter property name. /// - /// + /// /// Default value is null. - /// + /// [Parameter] public string? PropertyTypeName { get; set; } diff --git a/blazorbootstrap/Components/Grid/GridColumns.razor.cs b/blazorbootstrap/Components/Grid/GridColumns.razor.cs index 663227127..339b6b3ad 100644 --- a/blazorbootstrap/Components/Grid/GridColumns.razor.cs +++ b/blazorbootstrap/Components/Grid/GridColumns.razor.cs @@ -4,10 +4,12 @@ public partial class GridColumns : BlazorBootstrapComponentBase { /// /// Specifies the content to be rendered inside the grid columns component. - /// - /// + /// /// Default value is . - /// + /// + /// + [AddedVersion("1.0.0")] + [Description("Specifies the content to be rendered inside the grid columns component.")] [Parameter] - public RenderFragment? ChildContent { get; set; } = default!; + public RenderFragment? ChildContent { get; set; } } diff --git a/blazorbootstrap/Components/Grid/GridDetailView.razor.cs b/blazorbootstrap/Components/Grid/GridDetailView.razor.cs index 88a761bbd..ada06434b 100644 --- a/blazorbootstrap/Components/Grid/GridDetailView.razor.cs +++ b/blazorbootstrap/Components/Grid/GridDetailView.razor.cs @@ -16,12 +16,15 @@ protected override async Task OnInitializedAsync() /// /// Specifies the content to be rendered inside the component. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Specifies the content to be rendered inside the component.")] [Parameter] - public RenderFragment ChildContent { get; set; } = default!; + public RenderFragment? ChildContent { get; set; } internal RenderFragment GetTemplate => gridDetailViewTemplate ??= rowData => builder => diff --git a/blazorbootstrap/Components/Grid/GridEmptyDataTemplate.razor.cs b/blazorbootstrap/Components/Grid/GridEmptyDataTemplate.razor.cs index 81ea04f3c..73af4910a 100644 --- a/blazorbootstrap/Components/Grid/GridEmptyDataTemplate.razor.cs +++ b/blazorbootstrap/Components/Grid/GridEmptyDataTemplate.razor.cs @@ -16,12 +16,15 @@ protected override async Task OnInitializedAsync() /// /// Specifies the content to be rendered inside the component. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Specifies the content to be rendered inside the component.")] [Parameter] - public RenderFragment ChildContent { get; set; } = default!; + public RenderFragment? ChildContent { get; set; } internal RenderFragment Template => template ??= builder => diff --git a/blazorbootstrap/Components/Grid/GridLoadingTemplate.razor.cs b/blazorbootstrap/Components/Grid/GridLoadingTemplate.razor.cs index 51ac498cd..71adc4a78 100644 --- a/blazorbootstrap/Components/Grid/GridLoadingTemplate.razor.cs +++ b/blazorbootstrap/Components/Grid/GridLoadingTemplate.razor.cs @@ -16,12 +16,15 @@ protected override async Task OnInitializedAsync() /// /// Specifies the content to be rendered inside the component. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Specifies the content to be rendered inside the component.")] [Parameter] - public RenderFragment ChildContent { get; set; } = default!; + public RenderFragment? ChildContent { get; set; } internal RenderFragment Template => template ??= builder => diff --git a/blazorbootstrap/Components/Grid/GridTemplates.razor.cs b/blazorbootstrap/Components/Grid/GridTemplates.razor.cs index 9b1b112ea..3f4e2242f 100644 --- a/blazorbootstrap/Components/Grid/GridTemplates.razor.cs +++ b/blazorbootstrap/Components/Grid/GridTemplates.razor.cs @@ -4,10 +4,14 @@ public partial class GridTemplates : BlazorBootstrapComponentBase { /// /// Specifies the content to be rendered inside the grid templates component. + /// + /// Default value is . + /// /// - /// - /// Default value is null. - /// + [AddedVersion("1.0.0")] + [DefaultValue(null)] + [Description("Specifies the content to be rendered inside the grid templates component.")] + [EditorRequired] [Parameter] - public RenderFragment? ChildContent { get; set; } = default!; + public RenderFragment? ChildContent { get; set; } }