diff --git a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs
index 17f9cd9e4c..d046c89b94 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs
+++ b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs
@@ -3,7 +3,7 @@ using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
-using Volo.Abp.Data;
+using Volo.Abp.BlazoriseUI.Components.ObjectExtending;
using Volo.Abp.ObjectExtending;
using Volo.Abp.Reflection;
@@ -210,7 +210,7 @@ namespace Volo.Abp.BlazoriseUI
}
}
return GetInputTypeFromTypeOrNull(propertyInfo.Type)
- ?? typeof(TextEdit); //default
+ ?? typeof(TextExtensionProperty<,>); //default
}
private static Type GetInputTypeFromAttributeOrNull(Attribute attribute)
@@ -219,7 +219,7 @@ namespace Volo.Abp.BlazoriseUI
if (hasTextEditSupport)
{
- return typeof(TextEdit);
+ return typeof(TextExtensionProperty<,>);
}
//if (attribute is EmailAddressAttribute)
@@ -247,19 +247,19 @@ namespace Volo.Abp.BlazoriseUI
switch (dataTypeAttribute.DataType)
{
case DataType.Password:
- return typeof(TextEdit);
+ return typeof(TextExtensionProperty<,>);
case DataType.Date:
- return typeof(DateEdit<>);
+ return typeof(DateTimeExtensionProperty<,>);
case DataType.Time:
- return typeof(TimeEdit<>);
+ return typeof(TimeExtensionProperty<,>);
case DataType.EmailAddress:
- return typeof(TextEdit);
+ return typeof(TextExtensionProperty<,>);
case DataType.Url:
- return typeof(TextEdit);
+ return typeof(TextExtensionProperty<,>);
case DataType.PhoneNumber:
- return typeof(TextEdit);
+ return typeof(TextExtensionProperty<,>);
case DataType.DateTime:
- return typeof(DateEdit<>);
+ return typeof(DateTimeExtensionProperty<,>);
}
}
@@ -270,17 +270,17 @@ namespace Volo.Abp.BlazoriseUI
{
if (type == typeof(bool))
{
- return typeof(Check<>);
+ return typeof(CheckExtensionProperty<,>);
}
if (type == typeof(DateTime))
{
- return typeof(DateEdit<>);
+ return typeof(DateTimeExtensionProperty<,>);
}
if (NumberTypes.Contains(type))
{
- return typeof(TextEdit);
+ return typeof(TextExtensionProperty<,>);
}
return null;
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor
index 8632412d94..3a8e2720fc 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/AbpExtensibleDataGrid.razor
@@ -67,7 +67,7 @@
var entity = context as IHasExtraProperties;
var propertyName = ExtensionPropertiesRegex.Match(column.Data).Groups[1].Value;
var propertyValue = entity.GetProperty(propertyName);
- if (propertyValue.GetType() == typeof(bool))
+ if (propertyValue!=null && propertyValue.GetType() == typeof(bool))
{
if ((bool)propertyValue)
{
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/CheckExtensionProperty.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/CheckExtensionProperty.razor
new file mode 100644
index 0000000000..ed9f1664fe
--- /dev/null
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/CheckExtensionProperty.razor
@@ -0,0 +1,11 @@
+@typeparam TEntity
+@typeparam TResourceType
+@using Volo.Abp.BlazoriseUI
+@using Volo.Abp.Localization
+
+@if (PropertyInfo != null && Entity != null)
+{
+
+ @PropertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)
+
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/CheckExtensionProperty.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/CheckExtensionProperty.razor.cs
new file mode 100644
index 0000000000..3425d5c060
--- /dev/null
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/CheckExtensionProperty.razor.cs
@@ -0,0 +1,32 @@
+using Microsoft.AspNetCore.Components;
+using Microsoft.Extensions.Localization;
+using Volo.Abp.Data;
+using Volo.Abp.ObjectExtending;
+
+namespace Volo.Abp.BlazoriseUI.Components.ObjectExtending
+{
+ public partial class CheckExtensionProperty : ComponentBase
+ where TEntity : IHasExtraProperties
+ {
+ [Inject]
+ public IStringLocalizerFactory StringLocalizerFactory { get; set; }
+
+ [Parameter]
+ public TEntity Entity { get; set; }
+
+ [Parameter]
+ public ObjectExtensionPropertyInfo PropertyInfo { get; set; }
+
+ protected bool Value
+ {
+ get
+ {
+ return PropertyInfo.GetInputValueOrDefault(Entity.GetProperty(PropertyInfo.Name));
+ }
+ set
+ {
+ Entity.SetProperty(PropertyInfo.Name, value, false);
+ }
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/DateTimeExtensionProperty.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/DateTimeExtensionProperty.razor
new file mode 100644
index 0000000000..66d383b28c
--- /dev/null
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/DateTimeExtensionProperty.razor
@@ -0,0 +1,20 @@
+@typeparam TEntity
+@typeparam TResourceType
+@using Volo.Abp.BlazoriseUI
+@using Volo.Abp.Localization
+
+@if (PropertyInfo != null && Entity != null)
+{
+
+ @PropertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)
+
+
+
+ @**@
+
+}
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/DateTimeExtensionProperty.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/DateTimeExtensionProperty.razor.cs
new file mode 100644
index 0000000000..63fec8d262
--- /dev/null
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/DateTimeExtensionProperty.razor.cs
@@ -0,0 +1,37 @@
+using Microsoft.AspNetCore.Components;
+using Microsoft.Extensions.Localization;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Data;
+using Volo.Abp.ObjectExtending;
+
+namespace Volo.Abp.BlazoriseUI.Components.ObjectExtending
+{
+ public partial class DateTimeExtensionProperty : ComponentBase
+ where TEntity : IHasExtraProperties
+ {
+ [Inject]
+ public IStringLocalizerFactory StringLocalizerFactory { get; set; }
+
+ [Parameter]
+ public TEntity Entity { get; set; }
+
+ [Parameter]
+ public ObjectExtensionPropertyInfo PropertyInfo { get; set; }
+
+ protected DateTime? Value
+ {
+ get
+ {
+ return PropertyInfo.GetInputValueOrDefault(Entity.GetProperty(PropertyInfo.Name));
+ }
+ set
+ {
+ Entity.SetProperty(PropertyInfo.Name, value, false);
+ }
+ }
+ }
+}
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor
index 1498f2a885..b8d4a9b715 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor
@@ -15,48 +15,15 @@
else if (!propertyInfo.Lookup.Url.IsNullOrEmpty())
{
-
}
else
{
var inputType = propertyInfo.GetInputType();
- if (inputType == typeof(TextEdit))
- {
-
-
- }
- else if (inputType == typeof(Check<>))
- {
-
- @propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)
-
- }
- else if (inputType == typeof(TimeEdit<>))
- {
-
- @propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)-->
-
-
-
-
-
-
- }
- else if (inputType == typeof(DateEdit<>))
- {
-
- @propertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)
-
-
-
-
-
-
- }
+ __builder.OpenComponent(0, inputType.MakeGenericType(new[] { typeof(TEntityType), typeof(TResourceType) }));
+ __builder.AddAttribute(1, "PropertyInfo", propertyInfo);
+ __builder.AddAttribute(2, "Entity", Entity);
+ __builder.CloseComponent();
}
}
}
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor.cs
index ae461c7f8f..5f13e38458 100644
--- a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor.cs
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor.cs
@@ -17,25 +17,5 @@ namespace Volo.Abp.BlazoriseUI.Components.ObjectExtending
[Parameter]
public TEntityType Entity { get; set; }
-
- protected void TextChanged(string value, string propertyName)
- {
- Entity.SetProperty(propertyName, value);
- }
-
- protected void CheckedChanged(bool value, string propertyName)
- {
- Entity.SetProperty(propertyName, value);
- }
-
- protected void TimeChanged(TimeSpan? value, string propertyName)
- {
- Entity.SetProperty(propertyName, value);
- }
-
- protected void DateTimeChanged(DateTime? value, string propertyName)
- {
- Entity.SetProperty(propertyName, value);
- }
}
}
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TimeExtensionProperty.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TimeExtensionProperty.razor
new file mode 100644
index 0000000000..ce2215e621
--- /dev/null
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TimeExtensionProperty.razor
@@ -0,0 +1,13 @@
+@typeparam TEntity
+@typeparam TResourceType
+@using Volo.Abp.BlazoriseUI
+@using Volo.Abp.Localization
+
+@if (PropertyInfo != null && Entity != null)
+{
+
+ @PropertyInfo.GetLocalizedDisplayName(StringLocalizerFactory)-->
+
+
+
+}
\ No newline at end of file
diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TimeExtensionProperty.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TimeExtensionProperty.razor.cs
new file mode 100644
index 0000000000..b894c3e340
--- /dev/null
+++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TimeExtensionProperty.razor.cs
@@ -0,0 +1,37 @@
+using Microsoft.AspNetCore.Components;
+using Microsoft.Extensions.Localization;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.Data;
+using Volo.Abp.ObjectExtending;
+
+namespace Volo.Abp.BlazoriseUI.Components.ObjectExtending
+{
+ public partial class TimeExtensionProperty : ComponentBase
+ where TEntity : IHasExtraProperties
+ {
+ [Inject]
+ public IStringLocalizerFactory StringLocalizerFactory { get; set; }
+
+ [Parameter]
+ public TEntity Entity { get; set; }
+
+ [Parameter]
+ public ObjectExtensionPropertyInfo PropertyInfo { get; set; }
+
+ protected TimeSpan? Value
+ {
+ get
+ {
+ return PropertyInfo.GetInputValueOrDefault(Entity.GetProperty(PropertyInfo.Name));
+ }
+ set
+ {
+ Entity.SetProperty(PropertyInfo.Name, value, false);
+ }
+ }
+ }
+}