add datetime-local support and fix listing.

pull/7686/head
Ilkay Ilknur 5 years ago
parent 03fe7c0e54
commit f21ba0a80e

@ -10,6 +10,8 @@ namespace Volo.Abp.AspNetCore.Components.Extensibility.TableColumns
public string Title { get; set; }
public string Data { get; set; }
[CanBeNull]
public string DisplayFormat { get; set; }
[CanBeNull]
public Type Component { get; set; }
public List<EntityAction> Actions { get; set; }

@ -19,6 +19,7 @@ using Volo.Abp.Localization;
using Volo.Abp.Authorization;
using Volo.Abp.BlazoriseUI.Components;
using Volo.Abp.ObjectExtending.Modularity;
using Volo.Abp.ObjectExtending;
namespace Volo.Abp.BlazoriseUI
{
@ -502,10 +503,17 @@ namespace Volo.Abp.BlazoriseUI
}
else
{
string displayFormat = null;
if (propertyInfo.IsDate() || propertyInfo.IsDateTime())
{
displayFormat = propertyInfo.GetDateEditInputFormatOrNull();
}
yield return new TableColumn
{
Title = propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory),
Data = $"ExtraProperties[{propertyInfo.Name}]"
Data = $"ExtraProperties[{propertyInfo.Name}]",
DisplayFormat = displayFormat
};
}
}

@ -1,7 +1,6 @@
@typeparam TItem
@using Blazorise.DataGrid;
@using Volo.Abp.Data
@using Volo.Abp.BlazoriseUI.Components.ObjectExtending
<DataGrid TItem="TItem"
Data="@Data"
@ -67,7 +66,7 @@
var entity = context as IHasExtraProperties;
var propertyName = ExtensionPropertiesRegex.Match(column.Data).Groups[1].Value;
var propertyValue = entity.GetProperty(propertyName);
if (propertyValue!=null && propertyValue.GetType() == typeof(bool))
if (propertyValue != null && propertyValue.GetType() == typeof(bool))
{
if ((bool)propertyValue)
{
@ -80,7 +79,14 @@
}
else
{
@(propertyValue)
if (column.DisplayFormat == null)
{
@(propertyValue)
}
else
{
@(string.Format(column.DisplayFormat, propertyValue))
}
}
}
</DisplayTemplate>

@ -2,12 +2,14 @@
@typeparam TResourceType
@using Volo.Abp.BlazoriseUI
@using Volo.Abp.Localization
@using Volo.Abp.ObjectExtending
@if (PropertyInfo != null && Entity != null)
{
<Field>
<FieldLabel>@PropertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)</FieldLabel>
<DateEdit TValue="DateTime?"
InputMode="@(PropertyInfo.IsDate() ? DateInputMode.Date : DateInputMode.DateTime)"
Pattern="@PropertyInfo.GetDateEditInputFormatOrNull()"
@bind-Date="@Value">
</DateEdit>

Loading…
Cancel
Save