Browse Source

Added UI config for extra properties

pull/3834/head
Halil İbrahim Kalkan 6 years ago
parent
commit
ef54a6416f
  1. 8
      framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/CachedObjectExtensionsDtoService.cs
  2. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ModuleObjectExtraPropertyUiFormExtensionDto.cs
  3. 2
      framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ModuleObjectExtraPropertyUiTableExtensionDto.cs
  4. 4
      framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs
  5. 5
      framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ModuleEntityObjectPropertyExtensionConfiguration.cs
  6. 23
      framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ModuleEntityObjectPropertyExtensionUIConfiguration.cs
  7. 10
      framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ModuleEntityObjectPropertyExtensionUIFormConfiguration.cs
  8. 10
      framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ModuleEntityObjectPropertyExtensionUITableConfiguration.cs
  9. 9
      framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/TypeHelper_Tests.cs

8
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/CachedObjectExtensionsDtoService.cs

@ -28,6 +28,8 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending
protected virtual ObjectExtensionsDto GenerateCacheValue()
{
//TODO: Obviously needs refactoring!
var objectExtensionsDto = new ObjectExtensionsDto
{
Modules = new Dictionary<string, ModuleExtensionDto>()
@ -61,15 +63,15 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending
{
CreateForm = new ModuleObjectExtraPropertyUiFormExtensionDto
{
Visible = true
IsVisible = propertyConfig.UI.CreateForm.IsVisible
},
EditForm = new ModuleObjectExtraPropertyUiFormExtensionDto
{
Visible = true
IsVisible = propertyConfig.UI.EditForm.IsVisible
},
Table = new ModuleObjectExtraPropertyUiTableExtensionDto
{
Visible = true
IsVisible = propertyConfig.UI.Table.IsVisible
}
}
};

2
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ModuleObjectExtraPropertyUiFormExtensionDto.cs

@ -5,6 +5,6 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending
[Serializable]
public class ModuleObjectExtraPropertyUiFormExtensionDto
{
public bool Visible { get; set; }
public bool IsVisible { get; set; }
}
}

2
framework/src/Volo.Abp.AspNetCore.Mvc.Contracts/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/ObjectExtending/ModuleObjectExtraPropertyUiTableExtensionDto.cs

@ -5,6 +5,6 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations.ObjectExtending
[Serializable]
public class ModuleObjectExtraPropertyUiTableExtensionDto
{
public bool Visible { get; set; }
public bool IsVisible { get; set; }
}
}

4
framework/src/Volo.Abp.Core/Volo/Abp/Reflection/TypeHelper.cs

@ -133,9 +133,9 @@ namespace Volo.Abp.Reflection
type == typeof(Guid);
}
public static object GetDefaultValue<T>()
public static T GetDefaultValue<T>()
{
return GetDefaultValue(typeof(T));
return default;
}
public static object GetDefaultValue(Type type)

5
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ModuleEntityObjectPropertyExtensionConfiguration.cs

@ -36,6 +36,9 @@ namespace Volo.Abp.ObjectExtending
[NotNull]
public Dictionary<object, object> Configuration { get; }
[NotNull]
public ModuleEntityObjectPropertyExtensionUIConfiguration UI { get; }
public ModuleEntityObjectPropertyExtensionConfiguration(
[NotNull] ModuleEntityObjectExtensionConfiguration entityObjectExtensionConfiguration,
@ -51,6 +54,8 @@ namespace Volo.Abp.ObjectExtending
Configuration = new Dictionary<object, object>();
Attributes = new List<Attribute>();
Validators = new List<Action<ObjectExtensionPropertyValidationContext>>();
UI = new ModuleEntityObjectPropertyExtensionUIConfiguration();
}
}
}

23
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ModuleEntityObjectPropertyExtensionUIConfiguration.cs

@ -0,0 +1,23 @@
using JetBrains.Annotations;
namespace Volo.Abp.ObjectExtending
{
public class ModuleEntityObjectPropertyExtensionUIConfiguration
{
[NotNull]
public ModuleEntityObjectPropertyExtensionUITableConfiguration Table { get; }
[NotNull]
public ModuleEntityObjectPropertyExtensionUIFormConfiguration CreateForm { get; }
[NotNull]
public ModuleEntityObjectPropertyExtensionUIFormConfiguration EditForm { get; }
public ModuleEntityObjectPropertyExtensionUIConfiguration()
{
Table = new ModuleEntityObjectPropertyExtensionUITableConfiguration();
CreateForm = new ModuleEntityObjectPropertyExtensionUIFormConfiguration();
EditForm = new ModuleEntityObjectPropertyExtensionUIFormConfiguration();
}
}
}

10
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ModuleEntityObjectPropertyExtensionUIFormConfiguration.cs

@ -0,0 +1,10 @@
namespace Volo.Abp.ObjectExtending
{
public class ModuleEntityObjectPropertyExtensionUIFormConfiguration
{
/// <summary>
/// Default: true.
/// </summary>
public bool IsVisible { get; set; } = true;
}
}

10
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ModuleEntityObjectPropertyExtensionUITableConfiguration.cs

@ -0,0 +1,10 @@
namespace Volo.Abp.ObjectExtending
{
public class ModuleEntityObjectPropertyExtensionUITableConfiguration
{
/// <summary>
/// Default: true.
/// </summary>
public bool IsVisible { get; set; } = true;
}
}

9
framework/test/Volo.Abp.Core.Tests/Volo/Abp/Reflection/TypeHelper_Tests.cs

@ -66,6 +66,15 @@ namespace Volo.Abp.Reflection
).ShouldBeFalse();
}
[Fact]
public void GetDefaultValue()
{
TypeHelper.GetDefaultValue(typeof(bool)).ShouldBe(false);
TypeHelper.GetDefaultValue(typeof(byte)).ShouldBe(0);
TypeHelper.GetDefaultValue(typeof(int)).ShouldBe(0);
TypeHelper.GetDefaultValue(typeof(string)).ShouldBeNull();
}
public class MyDictionary : Dictionary<bool, TypeHelper_Tests>
{

Loading…
Cancel
Save