Browse Source

add datetime-local support and fix listing.

pull/7686/head
Ilkay Ilknur 6 years ago
parent
commit
f21ba0a80e
  1. 2
      framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumn.cs
  2. 10
      framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs
  3. 12
      framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor
  4. 2
      framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/DateTimeExtensionProperty.razor

2
framework/src/Volo.Abp.AspNetCore.Components.WebAssembly/Volo/Abp/AspNetCore/Components/Extensibility/TableColumns/TableColumn.cs

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

10
framework/src/Volo.Abp.BlazoriseUI/AbpCrudPageBase.cs

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

12
framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor

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

2
framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/DateTimeExtensionProperty.razor

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

Loading…
Cancel
Save