From 2139c282b45abe3b0a64309fe70aeb957f68084b Mon Sep 17 00:00:00 2001 From: EngincanV Date: Wed, 21 May 2025 12:48:17 +0300 Subject: [PATCH] Create `TextAreaExtensionProperty` to support multiline object extension for blazor ui --- ...UiObjectExtensionPropertyInfoExtensions.cs | 12 +++++------- .../TextAreaExtensionProperty.razor | 19 +++++++++++++++++++ .../TextAreaExtensionProperty.razor.cs | 15 +++++++++++++++ 3 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TextAreaExtensionProperty.razor create mode 100644 framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TextAreaExtensionProperty.razor.cs diff --git a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs index 2773b88bed8..fa4994e2f92 100644 --- a/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs +++ b/framework/src/Volo.Abp.BlazoriseUI/BlazoriseUiObjectExtensionPropertyInfoExtensions.cs @@ -233,19 +233,17 @@ public static Type GetInputType(this ObjectExtensionPropertyInfo propertyInfo) switch (dataTypeAttribute.DataType) { case DataType.Password: - return typeof(TextExtensionProperty<,>); - case DataType.Date: - return typeof(DateTimeExtensionProperty<,>); - case DataType.Time: - return typeof(TimeExtensionProperty<,>); case DataType.EmailAddress: - return typeof(TextExtensionProperty<,>); case DataType.Url: - return typeof(TextExtensionProperty<,>); case DataType.PhoneNumber: return typeof(TextExtensionProperty<,>); + case DataType.Date: case DataType.DateTime: return typeof(DateTimeExtensionProperty<,>); + case DataType.Time: + return typeof(TimeExtensionProperty<,>); + case DataType.MultilineText: + return typeof(TextAreaExtensionProperty<,>); } } diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TextAreaExtensionProperty.razor b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TextAreaExtensionProperty.razor new file mode 100644 index 00000000000..6acf7ba69dc --- /dev/null +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TextAreaExtensionProperty.razor @@ -0,0 +1,19 @@ +@typeparam TEntity +@typeparam TResourceType +@using Volo.Abp.BlazoriseUI +@using Volo.Abp.Localization +@inherits ExtensionPropertyComponentBase + +@if (PropertyInfo != null && Entity != null) +{ + + + @PropertyInfo.GetLocalizedDisplayName(StringLocalizerFactory) + + + + + + + +} diff --git a/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TextAreaExtensionProperty.razor.cs b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TextAreaExtensionProperty.razor.cs new file mode 100644 index 00000000000..853d1e73727 --- /dev/null +++ b/framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/TextAreaExtensionProperty.razor.cs @@ -0,0 +1,15 @@ +using Volo.Abp.Data; + +namespace Volo.Abp.BlazoriseUI.Components.ObjectExtending; +public partial class TextAreaExtensionProperty + where TEntity : IHasExtraProperties +{ + protected string? Value { + get { + return PropertyInfo.GetTextInputValueOrNull(Entity.GetProperty(PropertyInfo.Name)); + } + set { + Entity.SetProperty(PropertyInfo.Name, value, validate: false); + } + } +} \ No newline at end of file