Merge pull request #17254 from abpframework/liangshiwei/settingpage

Order setting tabs
EngincanV/maui-docs
maliming 2 years ago committed by GitHub
commit 209366593d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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));
@ -24,12 +26,15 @@ public class SettingComponentGroup
private Type _componentType;
public object Parameter { get; set; }
public int Order { get; set; }
public SettingComponentGroup([NotNull] string id, [NotNull] string displayName, [NotNull] Type componentType, object parameter = null)
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));
@ -24,12 +26,15 @@ public class SettingPageGroup
private Type _componentType;
public object Parameter { get; set; }
public int Order { get; set; }
public SettingPageGroup([NotNull] string id, [NotNull] string displayName, [NotNull] Type componentType, object parameter = null)
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;
}
}

Loading…
Cancel
Save