Browse Source
Add IsReadOnly and IsVisible to extension property modals
pull/24290/head
maliming
2 months ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
4 changed files with
46 additions and
2 deletions
-
framework/src/Volo.Abp.BlazoriseUI/Components/ObjectExtending/ExtensionProperties.razor.cs
-
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ExtensionPropertyUiFormConfiguration.cs
-
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/Modularity/ModuleExtensionConfigurationHelper.cs
-
framework/src/Volo.Abp.ObjectExtending/Volo/Abp/ObjectExtending/ObjectExtensionPropertyInfo.cs
|
|
|
@ -1,5 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System.Collections.Immutable; |
|
|
|
using System.Linq; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Microsoft.AspNetCore.Components; |
|
|
|
using Microsoft.Extensions.Localization; |
|
|
|
@ -29,8 +30,24 @@ public partial class ExtensionProperties<TEntityType, TResourceType> : Component |
|
|
|
|
|
|
|
public ImmutableList<ObjectExtensionPropertyInfo> Properties { get; set; } = ImmutableList<ObjectExtensionPropertyInfo>.Empty; |
|
|
|
|
|
|
|
protected async override Task OnInitializedAsync() |
|
|
|
protected override async Task OnInitializedAsync() |
|
|
|
{ |
|
|
|
Properties = await ObjectExtensionManager.Instance.GetPropertiesAndCheckPolicyAsync<TEntityType>(ServiceProvider); |
|
|
|
var properties = (await ObjectExtensionManager.Instance.GetPropertiesAndCheckPolicyAsync<TEntityType>(ServiceProvider)).ToList(); |
|
|
|
|
|
|
|
switch (ModalType) |
|
|
|
{ |
|
|
|
case ExtensionPropertyModalType.CreateModal: |
|
|
|
properties = properties |
|
|
|
.Where(p => p.UI.CreateModal.IsVisible) |
|
|
|
.ToList(); |
|
|
|
break; |
|
|
|
case ExtensionPropertyModalType.EditModal: |
|
|
|
properties = properties |
|
|
|
.Where(p => p.UI.EditModal.IsVisible) |
|
|
|
.ToList(); |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
Properties = properties.ToImmutableList(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -6,4 +6,9 @@ public class ExtensionPropertyUiFormConfiguration |
|
|
|
/// Default: true.
|
|
|
|
/// </summary>
|
|
|
|
public bool IsVisible { get; set; } = true; |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Default: false.
|
|
|
|
/// </summary>
|
|
|
|
public bool IsReadOnly { get; set; } = false; |
|
|
|
} |
|
|
|
|
|
|
|
@ -175,6 +175,10 @@ public static class ModuleExtensionConfigurationHelper |
|
|
|
property.DefaultValueFactory = propertyConfig.DefaultValueFactory; |
|
|
|
property.Lookup = propertyConfig.UI.Lookup; |
|
|
|
property.UI.Order = propertyConfig.UI.Order; |
|
|
|
property.UI.CreateModal.IsVisible = propertyConfig.UI.OnCreateForm.IsVisible; |
|
|
|
property.UI.CreateModal.IsReadOnly = propertyConfig.UI.OnCreateForm.IsReadOnly; |
|
|
|
property.UI.EditModal.IsVisible = propertyConfig.UI.OnEditForm.IsVisible; |
|
|
|
property.UI.EditModal.IsReadOnly = propertyConfig.UI.OnEditForm.IsReadOnly; |
|
|
|
property.Policy = propertyConfig.Policy; |
|
|
|
foreach (var configuration in propertyConfig.Configuration) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -90,16 +90,34 @@ public class ObjectExtensionPropertyInfo : IHasNameWithLocalizableDisplayName, I |
|
|
|
{ |
|
|
|
public int Order { get; set; } |
|
|
|
|
|
|
|
public ExtensionPropertyUICreateModal CreateModal { get; set; } |
|
|
|
|
|
|
|
public ExtensionPropertyUIEditModal EditModal { get; set; } |
|
|
|
|
|
|
|
public ExtensionPropertyUI() |
|
|
|
{ |
|
|
|
CreateModal = new ExtensionPropertyUICreateModal(); |
|
|
|
EditModal = new ExtensionPropertyUIEditModal(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public class ExtensionPropertyUICreateModal |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// Default: true.
|
|
|
|
/// </summary>
|
|
|
|
public bool IsVisible { get; set; } = true; |
|
|
|
|
|
|
|
public bool IsReadOnly { get; set; } |
|
|
|
} |
|
|
|
|
|
|
|
public class ExtensionPropertyUIEditModal |
|
|
|
{ |
|
|
|
/// <summary>
|
|
|
|
/// Default: true.
|
|
|
|
/// </summary>
|
|
|
|
public bool IsVisible { get; set; } = true; |
|
|
|
|
|
|
|
public bool IsReadOnly { get; set; } |
|
|
|
} |
|
|
|
} |
|
|
|
|