Browse Source
Merge pull request #16930 from abpframework/liangshiwei/objectextend
Add order to extended properties
pull/16939/head
maliming
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with
14 additions and
3 deletions
-
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/EntityExtensionConfiguration.cs
-
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ExtensionPropertyUiConfiguration.cs
-
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs
-
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ObjectExtensionInfo.cs
-
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ObjectExtensionPropertyInfo.cs
|
|
|
@ -1,6 +1,7 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Immutable; |
|
|
|
using System.Linq; |
|
|
|
using JetBrains.Annotations; |
|
|
|
using Volo.Abp.Localization; |
|
|
|
|
|
|
|
@ -74,7 +75,7 @@ public class EntityExtensionConfiguration |
|
|
|
[NotNull] |
|
|
|
public virtual ImmutableList<ExtensionPropertyConfiguration> GetProperties() |
|
|
|
{ |
|
|
|
return Properties.Values.ToImmutableList(); |
|
|
|
return Properties.Values.OrderBy(t => t.UI.Order).ToImmutableList(); |
|
|
|
} |
|
|
|
|
|
|
|
private static void NormalizeProperty(ExtensionPropertyConfiguration propertyInfo) |
|
|
|
|
|
|
|
@ -4,6 +4,8 @@ namespace Volo.Abp.ObjectExtending.Modularity; |
|
|
|
|
|
|
|
public class ExtensionPropertyUiConfiguration |
|
|
|
{ |
|
|
|
public const int DefaultOrder = 1000; |
|
|
|
|
|
|
|
[NotNull] |
|
|
|
public ExtensionPropertyUiTableConfiguration OnTable { get; } |
|
|
|
|
|
|
|
@ -15,6 +17,8 @@ public class ExtensionPropertyUiConfiguration |
|
|
|
|
|
|
|
[NotNull] |
|
|
|
public ExtensionPropertyLookupConfiguration Lookup { get; set; } |
|
|
|
|
|
|
|
public int Order { get; set; } |
|
|
|
|
|
|
|
public ExtensionPropertyUiConfiguration() |
|
|
|
{ |
|
|
|
@ -22,5 +26,6 @@ public class ExtensionPropertyUiConfiguration |
|
|
|
OnCreateForm = new ExtensionPropertyUiFormConfiguration(); |
|
|
|
OnEditForm = new ExtensionPropertyUiFormConfiguration(); |
|
|
|
Lookup = new ExtensionPropertyLookupConfiguration(); |
|
|
|
Order = DefaultOrder; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -174,6 +174,7 @@ public static class ModuleExtensionConfigurationHelper |
|
|
|
property.DefaultValue = propertyConfig.DefaultValue; |
|
|
|
property.DefaultValueFactory = propertyConfig.DefaultValueFactory; |
|
|
|
property.Lookup = propertyConfig.UI.Lookup; |
|
|
|
property.Order = propertyConfig.UI.Order; |
|
|
|
foreach (var configuration in propertyConfig.Configuration) |
|
|
|
{ |
|
|
|
property.Configuration[configuration.Key] = configuration.Value; |
|
|
|
|
|
|
|
@ -69,8 +69,7 @@ public class ObjectExtensionInfo |
|
|
|
[NotNull] |
|
|
|
public virtual ImmutableList<ObjectExtensionPropertyInfo> GetProperties() |
|
|
|
{ |
|
|
|
return Properties.OrderBy(t => t.Key) |
|
|
|
.Select(t => t.Value) |
|
|
|
return Properties.OrderBy(t => t.Value.Order).Select(t => t.Value) |
|
|
|
.ToImmutableList(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -59,6 +59,11 @@ public class ObjectExtensionPropertyInfo : IHasNameWithLocalizableDisplayName, I |
|
|
|
|
|
|
|
[NotNull] |
|
|
|
public ExtensionPropertyLookupConfiguration Lookup { get; set; } |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// The Display order of the Property.
|
|
|
|
/// </summary>
|
|
|
|
public int Order { get; set; } |
|
|
|
|
|
|
|
public ObjectExtensionPropertyInfo( |
|
|
|
[NotNull] ObjectExtensionInfo objectExtension, |
|
|
|
|