Browse Source

Upgrade MudBlazor to 9.4.0

- Directory.Packages.props bumps MudBlazor 8.0.0 to 9.4.0
- AbpMudCrudPageBase: ShowMessageBox to ShowMessageBoxAsync, OnDataGridReadAsync adds CancellationToken
- AbpMudExtensibleDataGrid: ServerData adds CancellationToken, SortFunc becomes Func<TItem, object?>
- basic-theme LoginDisplay (Server + WASM): name MudMenu ActivatorContent context to avoid AuthorizeView clash
- permission-management and feature-management modals: ShowMessageBox to ShowMessageBoxAsync
pull/25393/head
maliming 5 months ago
parent
commit
35b4d6b774
No known key found for this signature in database GPG Key ID: A646B9CB645ECEA4
  1. 2
      Directory.Packages.props
  2. 5
      framework/src/Volo.Abp.MudBlazorUI/AbpMudCrudPageBase.cs
  3. 15
      framework/src/Volo.Abp.MudBlazorUI/Components/AbpMudExtensibleDataGrid.razor.cs
  4. 2
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.MudBlazorBasicTheme/Themes/Basic/LoginDisplay.razor
  5. 2
      modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.MudBlazorBasicTheme/Themes/Basic/LoginDisplay.razor
  6. 2
      modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor.MudBlazor/Components/FeatureManagementModal.razor.cs
  7. 2
      modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor.MudBlazor/Components/PermissionManagementModal.razor.cs
  8. 2
      modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor.MudBlazor/Components/ResourcePermissionManagementModal.razor.cs

2
Directory.Packages.props

@ -23,7 +23,7 @@
<PackageVersion Include="Blazorise.Components" Version="2.0.4" /> <PackageVersion Include="Blazorise.Components" Version="2.0.4" />
<PackageVersion Include="Blazorise.DataGrid" Version="2.0.4" /> <PackageVersion Include="Blazorise.DataGrid" Version="2.0.4" />
<PackageVersion Include="Blazorise.Snackbar" Version="2.0.4" /> <PackageVersion Include="Blazorise.Snackbar" Version="2.0.4" />
<PackageVersion Include="MudBlazor" Version="8.0.0" /> <PackageVersion Include="MudBlazor" Version="9.4.0" />
<PackageVersion Include="Castle.Core" Version="5.2.1" /> <PackageVersion Include="Castle.Core" Version="5.2.1" />
<PackageVersion Include="Castle.Core.AsyncInterceptor" Version="2.1.0" /> <PackageVersion Include="Castle.Core.AsyncInterceptor" Version="2.1.0" />
<PackageVersion Include="CommonMark.NET" Version="0.15.1" /> <PackageVersion Include="CommonMark.NET" Version="0.15.1" />

5
framework/src/Volo.Abp.MudBlazorUI/AbpMudCrudPageBase.cs

@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Localization.Resources.AbpUi; using Localization.Resources.AbpUi;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
@ -332,7 +333,7 @@ public abstract class AbpMudCrudPageBase<
} }
} }
protected virtual async Task<GridData<TListViewModel>> OnDataGridReadAsync(GridState<TListViewModel> state) protected virtual async Task<GridData<TListViewModel>> OnDataGridReadAsync(GridState<TListViewModel> state, CancellationToken cancellationToken = default)
{ {
CurrentSorting = state.SortDefinitions CurrentSorting = state.SortDefinitions
.Select(s => _dataGrid.ResolveSortPropertyName(s) + (s.Descending ? " DESC" : "")) .Select(s => _dataGrid.ResolveSortPropertyName(s) + (s.Descending ? " DESC" : ""))
@ -617,7 +618,7 @@ public abstract class AbpMudCrudPageBase<
protected virtual async Task<bool> ConfirmDeleteAsync(TListViewModel entity) protected virtual async Task<bool> ConfirmDeleteAsync(TListViewModel entity)
{ {
var result = await DialogService.ShowMessageBox( var result = await DialogService.ShowMessageBoxAsync(
UiLocalizer["AreYouSure"], UiLocalizer["AreYouSure"],
GetDeleteConfirmationMessage(entity), GetDeleteConfirmationMessage(entity),
yesText: UiLocalizer["Yes"], yesText: UiLocalizer["Yes"],

15
framework/src/Volo.Abp.MudBlazorUI/Components/AbpMudExtensibleDataGrid.razor.cs

@ -4,6 +4,7 @@ using System.Globalization;
using System.Linq; using System.Linq;
using System.Reflection; using System.Reflection;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using Localization.Resources.AbpUi; using Localization.Resources.AbpUi;
using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components;
@ -28,9 +29,9 @@ public partial class AbpMudExtensibleDataGrid<TItem> : ComponentBase
/// Maps SortBy func references to their corresponding property names. /// Maps SortBy func references to their corresponding property names.
/// Used to resolve property names from MudBlazor SortDefinition.SortFunc. /// Used to resolve property names from MudBlazor SortDefinition.SortFunc.
/// </summary> /// </summary>
private readonly Dictionary<Func<TItem, object>, string> _sortFuncToPropertyMap = new(); private readonly Dictionary<Func<TItem, object?>, string> _sortFuncToPropertyMap = new();
[Parameter] public Func<GridState<TItem>, Task<GridData<TItem>>>? ServerData { get; set; } [Parameter] public Func<GridState<TItem>, CancellationToken, Task<GridData<TItem>>>? ServerData { get; set; }
[Parameter] public bool Loading { get; set; } [Parameter] public bool Loading { get; set; }
@ -192,7 +193,7 @@ public partial class AbpMudExtensibleDataGrid<TItem> : ComponentBase
return string.Empty; return string.Empty;
} }
protected virtual Func<TItem, object>? GetSortByFunc(TableColumn column) protected virtual Func<TItem, object?>? GetSortByFunc(TableColumn column)
{ {
if (!column.Sortable) if (!column.Sortable)
{ {
@ -221,7 +222,7 @@ public partial class AbpMudExtensibleDataGrid<TItem> : ComponentBase
var parameter = System.Linq.Expressions.Expression.Parameter(typeof(TItem), "x"); var parameter = System.Linq.Expressions.Expression.Parameter(typeof(TItem), "x");
System.Linq.Expressions.Expression expression = parameter; System.Linq.Expressions.Expression expression = parameter;
Func<TItem, object>? sortFunc = null; Func<TItem, object?>? sortFunc = null;
foreach (var prop in properties) foreach (var prop in properties)
{ {
var propertyInfo = expression.Type.GetProperty(prop, BindingFlags.Public | BindingFlags.Instance); var propertyInfo = expression.Type.GetProperty(prop, BindingFlags.Public | BindingFlags.Instance);
@ -237,7 +238,7 @@ public partial class AbpMudExtensibleDataGrid<TItem> : ComponentBase
if (sortFunc == null) if (sortFunc == null)
{ {
var convertExpression = System.Linq.Expressions.Expression.Convert(expression, typeof(object)); var convertExpression = System.Linq.Expressions.Expression.Convert(expression, typeof(object));
var lambda = System.Linq.Expressions.Expression.Lambda<Func<TItem, object>>(convertExpression, parameter); var lambda = System.Linq.Expressions.Expression.Lambda<Func<TItem, object?>>(convertExpression, parameter);
sortFunc = lambda.Compile(); sortFunc = lambda.Compile();
} }
@ -247,7 +248,7 @@ public partial class AbpMudExtensibleDataGrid<TItem> : ComponentBase
return sortFunc; return sortFunc;
} }
protected virtual Func<TItem, object>? GetExtensionPropertySortFunc(TableColumn column) protected virtual Func<TItem, object?>? GetExtensionPropertySortFunc(TableColumn column)
{ {
if (!column.Sortable || string.IsNullOrWhiteSpace(column.Data)) if (!column.Sortable || string.IsNullOrWhiteSpace(column.Data))
{ {
@ -261,7 +262,7 @@ public partial class AbpMudExtensibleDataGrid<TItem> : ComponentBase
} }
var propertyName = match.Groups[1].Value; var propertyName = match.Groups[1].Value;
Func<TItem, object> sortFunc = item => Func<TItem, object?> sortFunc = item =>
{ {
var entity = item as IHasExtraProperties; var entity = item as IHasExtraProperties;
return entity?.GetProperty(propertyName) ?? string.Empty; return entity?.GetProperty(propertyName) ?? string.Empty;

2
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.Server.MudBlazorBasicTheme/Themes/Basic/LoginDisplay.razor

@ -14,7 +14,7 @@
<AuthorizeView> <AuthorizeView>
<Authorized> <Authorized>
<MudMenu> <MudMenu>
<ActivatorContent> <ActivatorContent Context="menuActivator">
<MudIconButton Icon="@Icons.Material.Outlined.AccountCircle" Color="Color.Inherit" /> <MudIconButton Icon="@Icons.Material.Outlined.AccountCircle" Color="Color.Inherit" />
</ActivatorContent> </ActivatorContent>
<ChildContent> <ChildContent>

2
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.MudBlazorBasicTheme/Themes/Basic/LoginDisplay.razor

@ -17,7 +17,7 @@
<AuthorizeView> <AuthorizeView>
<Authorized> <Authorized>
<MudMenu> <MudMenu>
<ActivatorContent> <ActivatorContent Context="menuActivator">
<MudIconButton Icon="@Icons.Material.Outlined.AccountCircle" Color="Color.Inherit" /> <MudIconButton Icon="@Icons.Material.Outlined.AccountCircle" Color="Color.Inherit" />
</ActivatorContent> </ActivatorContent>
<ChildContent> <ChildContent>

2
modules/feature-management/src/Volo.Abp.FeatureManagement.Blazor.MudBlazor/Components/FeatureManagementModal.razor.cs

@ -140,7 +140,7 @@ public partial class FeatureManagementModal
{ {
try try
{ {
var confirmed = await DialogService.ShowMessageBox( var confirmed = await DialogService.ShowMessageBoxAsync(
L["AreYouSure"], L["AreYouSure"],
L["AreYouSureToResetToDefault"], L["AreYouSureToResetToDefault"],
yesText: L["Yes"], yesText: L["Yes"],

2
modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor.MudBlazor/Components/PermissionManagementModal.razor.cs

@ -144,7 +144,7 @@ public partial class PermissionManagementModal
if (!updateDto.Permissions.Any(x => x.IsGranted)) if (!updateDto.Permissions.Any(x => x.IsGranted))
{ {
var confirmed = await DialogService.ShowMessageBox( var confirmed = await DialogService.ShowMessageBoxAsync(
L["Warning"], L["Warning"],
L["SaveWithoutAnyPermissionsWarningMessage"], L["SaveWithoutAnyPermissionsWarningMessage"],
yesText: L["Yes"], yesText: L["Yes"],

2
modules/permission-management/src/Volo.Abp.PermissionManagement.Blazor.MudBlazor/Components/ResourcePermissionManagementModal.razor.cs

@ -291,7 +291,7 @@ public partial class ResourcePermissionManagementModal
protected virtual async Task DeleteResourcePermissionAsync(ResourcePermissionGrantInfoDto permission) protected virtual async Task DeleteResourcePermissionAsync(ResourcePermissionGrantInfoDto permission)
{ {
var confirmed = await DialogService.ShowMessageBox( var confirmed = await DialogService.ShowMessageBoxAsync(
L["AreYouSure"], L["AreYouSure"],
L["ResourcePermissionDeletionConfirmationMessage"], L["ResourcePermissionDeletionConfirmationMessage"],
yesText: L["Yes"], yesText: L["Yes"],

Loading…
Cancel
Save