Browse Source
Make `DateTimeExtensionProperty` support `DisplayFormatAttribute`.
Resolve #20037
pull/20038/head
maliming
2 years ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
1 changed files with
14 additions and
0 deletions
-
framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs
|
|
|
@ -46,6 +46,12 @@ public static class BlazoriseUiObjectExtensionPropertyInfoExtensions |
|
|
|
|
|
|
|
public static string? GetDateEditInputFormatOrNull(this IBasicObjectExtensionPropertyInfo property) |
|
|
|
{ |
|
|
|
var dataFormatString = property.GetDataFormatStringOrNull(); |
|
|
|
if (dataFormatString != null) |
|
|
|
{ |
|
|
|
return dataFormatString; |
|
|
|
} |
|
|
|
|
|
|
|
if (property.IsDate()) |
|
|
|
{ |
|
|
|
return "{0:yyyy-MM-dd}"; |
|
|
|
@ -59,6 +65,14 @@ public static class BlazoriseUiObjectExtensionPropertyInfoExtensions |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
public static string? GetDataFormatStringOrNull(this IBasicObjectExtensionPropertyInfo property) |
|
|
|
{ |
|
|
|
return property |
|
|
|
.Attributes |
|
|
|
.OfType<DisplayFormatAttribute>() |
|
|
|
.FirstOrDefault()?.DataFormatString; |
|
|
|
} |
|
|
|
|
|
|
|
public static string? GetTextInputValueOrNull(this IBasicObjectExtensionPropertyInfo property, object? value) |
|
|
|
{ |
|
|
|
if (value == null) |
|
|
|
|