Browse Source

Make mvc ui `ExtendingPropertry` support `DisplayFormatAttribute`

pull/9849/head
jadyn 5 years ago
parent
commit
bd4f26aa64
  1. 7
      framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/ObjectExtending/MvcUiObjectExtensionPropertyInfoExtensions.cs
  2. 8
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/ObjectExtending/ObjectExtensionPropertyInfoAspNetCoreMvcExtensions.cs

7
framework/src/Volo.Abp.AspNetCore.Mvc.UI/Volo/Abp/ObjectExtending/MvcUiObjectExtensionPropertyInfoExtensions.cs

@ -37,6 +37,13 @@ namespace Volo.Abp.ObjectExtending
public static string GetInputFormatOrNull(this IBasicObjectExtensionPropertyInfo property)
{
var formatString = property.GetDataFormatString();
if (!formatString.IsNullOrWhiteSpace())
{
return formatString;
}
if (property.IsDate())
{
return "{0:yyyy-MM-dd}";

8
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/ObjectExtending/ObjectExtensionPropertyInfoAspNetCoreMvcExtensions.cs

@ -33,5 +33,13 @@ namespace Volo.Abp.ObjectExtending
.OfType<DataTypeAttribute>()
.FirstOrDefault()?.DataType;
}
public static string GetDataFormatString(this IBasicObjectExtensionPropertyInfo property)
{
return property
.Attributes
.OfType<DisplayFormatAttribute>()
.FirstOrDefault()?.DataFormatString;
}
}
}

Loading…
Cancel
Save