Browse Source
Merge pull request #17254 from abpframework/liangshiwei/settingpage
Order setting tabs
EngincanV/maui-docs
maliming
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with
46 additions and
9 deletions
-
docs/en/Modules/Setting-Management.md
-
docs/zh-Hans/Modules/Setting-Management.md
-
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/Pages/SettingManagement/SettingManagement.razor.cs
-
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/SettingComponentCreationContext.cs
-
modules/setting-management/src/Volo.Abp.SettingManagement.Blazor/SettingComponentGroup.cs
-
modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/SettingPageContributorManager.cs
-
modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/SettingPageCreationContext.cs
-
modules/setting-management/src/Volo.Abp.SettingManagement.Web/Pages/SettingManagement/SettingPageGroup.cs
|
|
|
@ -177,7 +177,8 @@ public class BookStoreSettingPageContributor : ISettingPageContributor |
|
|
|
new SettingPageGroup( |
|
|
|
"Volo.Abp.MySettingGroup", |
|
|
|
"MySettingGroup", |
|
|
|
typeof(MySettingGroupViewComponent) |
|
|
|
typeof(MySettingGroupViewComponent), |
|
|
|
order : 1 |
|
|
|
) |
|
|
|
); |
|
|
|
|
|
|
|
@ -240,7 +241,8 @@ public class BookStoreSettingComponentContributor : ISettingComponentContributor |
|
|
|
new SettingComponentGroup( |
|
|
|
"Volo.Abp.MySettingGroup", |
|
|
|
"MySettingGroup", |
|
|
|
typeof(MySettingGroupComponent) |
|
|
|
typeof(MySettingGroupComponent), |
|
|
|
order : 1 |
|
|
|
) |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
@ -146,7 +146,8 @@ public class BookStoreSettingPageContributor : ISettingPageContributor |
|
|
|
new SettingPageGroup( |
|
|
|
"Volo.Abp.MySettingGroup", |
|
|
|
"MySettingGroup", |
|
|
|
typeof(MySettingGroupViewComponent) |
|
|
|
typeof(MySettingGroupViewComponent), |
|
|
|
order : 1 |
|
|
|
) |
|
|
|
); |
|
|
|
|
|
|
|
@ -209,7 +210,8 @@ public class BookStoreSettingComponentContributor : ISettingComponentContributor |
|
|
|
new SettingComponentGroup( |
|
|
|
"Volo.Abp.MySettingGroup", |
|
|
|
"MySettingGroup", |
|
|
|
typeof(MySettingGroupComponent) |
|
|
|
typeof(MySettingGroupComponent), |
|
|
|
order : 1 |
|
|
|
) |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
@ -39,7 +39,7 @@ public partial class SettingManagement |
|
|
|
{ |
|
|
|
await contributor.ConfigureAsync(SettingComponentCreationContext); |
|
|
|
} |
|
|
|
|
|
|
|
SettingComponentCreationContext.Normalize(); |
|
|
|
SettingItemRenders.Clear(); |
|
|
|
|
|
|
|
SelectedGroup = GetNormalizedString(SettingComponentCreationContext.Groups.First().Id); |
|
|
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
|
|
|
|
namespace Volo.Abp.SettingManagement.Blazor; |
|
|
|
@ -8,7 +9,7 @@ public class SettingComponentCreationContext : IServiceProviderAccessor |
|
|
|
{ |
|
|
|
public IServiceProvider ServiceProvider { get; } |
|
|
|
|
|
|
|
public List<SettingComponentGroup> Groups { get; } |
|
|
|
public List<SettingComponentGroup> Groups { get; private set; } |
|
|
|
|
|
|
|
public SettingComponentCreationContext(IServiceProvider serviceProvider) |
|
|
|
{ |
|
|
|
@ -16,4 +17,14 @@ public class SettingComponentCreationContext : IServiceProviderAccessor |
|
|
|
|
|
|
|
Groups = new List<SettingComponentGroup>(); |
|
|
|
} |
|
|
|
|
|
|
|
public void Normalize() |
|
|
|
{ |
|
|
|
Order(); |
|
|
|
} |
|
|
|
|
|
|
|
private void Order() |
|
|
|
{ |
|
|
|
Groups = Groups.OrderBy(item => item.Order).ThenBy(item => item.DisplayName).ToList(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -5,6 +5,8 @@ namespace Volo.Abp.SettingManagement.Blazor; |
|
|
|
|
|
|
|
public class SettingComponentGroup |
|
|
|
{ |
|
|
|
public const int DefaultOrder = 1000; |
|
|
|
|
|
|
|
public string Id { |
|
|
|
get => _id; |
|
|
|
set => _id = Check.NotNullOrWhiteSpace(value, nameof(Id)); |
|
|
|
@ -25,11 +27,14 @@ public class SettingComponentGroup |
|
|
|
|
|
|
|
public object Parameter { get; set; } |
|
|
|
|
|
|
|
public SettingComponentGroup([NotNull] string id, [NotNull] string displayName, [NotNull] Type componentType, object parameter = null) |
|
|
|
public int Order { get; set; } |
|
|
|
|
|
|
|
public SettingComponentGroup([NotNull] string id, [NotNull] string displayName, [NotNull] Type componentType, object parameter = null, int order = DefaultOrder) |
|
|
|
{ |
|
|
|
Id = id; |
|
|
|
DisplayName = displayName; |
|
|
|
ComponentType = componentType; |
|
|
|
Parameter = parameter; |
|
|
|
Order = order; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -37,6 +37,7 @@ public class SettingPageContributorManager : IScopedDependency |
|
|
|
{ |
|
|
|
await contributor.ConfigureAsync(context); |
|
|
|
} |
|
|
|
context.Normalize(); |
|
|
|
return context; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using Volo.Abp.DependencyInjection; |
|
|
|
|
|
|
|
namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement; |
|
|
|
@ -8,7 +9,7 @@ public class SettingPageCreationContext : IServiceProviderAccessor |
|
|
|
{ |
|
|
|
public IServiceProvider ServiceProvider { get; } |
|
|
|
|
|
|
|
public List<SettingPageGroup> Groups { get; } |
|
|
|
public List<SettingPageGroup> Groups { get; private set; } |
|
|
|
|
|
|
|
public SettingPageCreationContext(IServiceProvider serviceProvider) |
|
|
|
{ |
|
|
|
@ -16,4 +17,14 @@ public class SettingPageCreationContext : IServiceProviderAccessor |
|
|
|
|
|
|
|
Groups = new List<SettingPageGroup>(); |
|
|
|
} |
|
|
|
|
|
|
|
public void Normalize() |
|
|
|
{ |
|
|
|
Order(); |
|
|
|
} |
|
|
|
|
|
|
|
private void Order() |
|
|
|
{ |
|
|
|
Groups = Groups.OrderBy(item => item.Order).ThenBy(item => item.DisplayName).ToList(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -5,6 +5,8 @@ namespace Volo.Abp.SettingManagement.Web.Pages.SettingManagement; |
|
|
|
|
|
|
|
public class SettingPageGroup |
|
|
|
{ |
|
|
|
public const int DefaultOrder = 1000; |
|
|
|
|
|
|
|
public string Id { |
|
|
|
get => _id; |
|
|
|
set => _id = Check.NotNullOrWhiteSpace(value, nameof(Id)); |
|
|
|
@ -25,11 +27,14 @@ public class SettingPageGroup |
|
|
|
|
|
|
|
public object Parameter { get; set; } |
|
|
|
|
|
|
|
public SettingPageGroup([NotNull] string id, [NotNull] string displayName, [NotNull] Type componentType, object parameter = null) |
|
|
|
public int Order { get; set; } |
|
|
|
|
|
|
|
public SettingPageGroup([NotNull] string id, [NotNull] string displayName, [NotNull] Type componentType, object parameter = null, int order = DefaultOrder) |
|
|
|
{ |
|
|
|
Id = id; |
|
|
|
DisplayName = displayName; |
|
|
|
ComponentType = componentType; |
|
|
|
Parameter = parameter; |
|
|
|
Order = order; |
|
|
|
} |
|
|
|
} |
|
|
|
|