Made EntityAction.IsVisible public.

pull/8074/head
Halil İbrahim Kalkan 5 years ago
parent 9c4e87f6cb
commit 3badaafade

@ -1,16 +1,15 @@
@typeparam TItem
@using Blazorise
@if (ParentActions.Type == ActionType.Dropdown)
@if (IsVisible && HasPermission)
{
if (IsVisible && Primary == false)
if (ParentActions.Type == ActionType.Dropdown)
{
<DropdownItem Clicked="@ActionClickedAsync">@Text</DropdownItem>
if (Primary == false)
{
<DropdownItem Clicked="@ActionClickedAsync">@Text</DropdownItem>
}
}
}
else
{
if (IsVisible)
else
{
<Button Block="true"
Color="@Color"
@ -18,4 +17,4 @@ else
@Text
</Button>
}
}
}

@ -1,4 +1,5 @@
using System;
using System.Diagnostics.SymbolStore;
using System.Threading.Tasks;
using Blazorise;
using Microsoft.AspNetCore.Authorization;
@ -9,7 +10,10 @@ namespace Volo.Abp.BlazoriseUI.Components
{
public partial class EntityAction<TItem> : ComponentBase
{
internal bool IsVisible = true;
[Parameter]
public bool IsVisible { get; set; } = true;
internal bool HasPermission { get; set; } = true;
[Parameter]
public string Text { get; set; }
@ -44,7 +48,7 @@ namespace Volo.Abp.BlazoriseUI.Components
await SetDefaultValuesAsync();
if (!RequiredPolicy.IsNullOrEmpty())
{
IsVisible = await AuthorizationService.IsGrantedAsync(RequiredPolicy);
HasPermission = await AuthorizationService.IsGrantedAsync(RequiredPolicy);
}
ParentActions.AddAction(this);
}

@ -52,7 +52,7 @@ namespace Volo.Abp.BlazoriseUI.Components
{
if (ParentEntityActionsColumn != null)
{
ParentEntityActionsColumn.Displayable = Actions.Any(t => t.IsVisible);
ParentEntityActionsColumn.Displayable = Actions.Any(t => t.IsVisible && t.HasPermission);
}
await InvokeAsync(StateHasChanged);

Loading…
Cancel
Save