feat(module: table): add support for Display attribute (#1310)

feat(module:table): add support for Display attribute

Display attribute is widely used to specify display text for entity properties.
Table component should get column names from Display attribute instances.

Closes #1278
This commit is contained in:
anranruye 2021-04-04 20:38:57 +08:00 committed by GitHub
parent 3da9e703fa
commit c06e73ba5b

View File

@ -21,7 +21,9 @@ namespace AntDesign.Core.Reflection
{
this.PropertyInfo = propertyInfo;
this.RequiredAttribute = propertyInfo.GetCustomAttribute<RequiredAttribute>(true);
this.DisplayName = propertyInfo.GetCustomAttribute<DisplayNameAttribute>(true)?.DisplayName ?? propertyInfo.Name;
this.DisplayName = propertyInfo.GetCustomAttribute<DisplayNameAttribute>(true)?.DisplayName ??
propertyInfo.GetCustomAttribute<DisplayAttribute>(true)?.Name ??
propertyInfo.Name;
this.PropertyName = PropertyInfo.Name;
}