mirror of https://github.com/abpframework/abp.git
31 changed files with 99 additions and 41 deletions
@ -0,0 +1,7 @@ |
|||
@if (LayoutHookViewModel.Hooks.Any()) |
|||
{ |
|||
foreach (var hook in LayoutHookViewModel.Hooks) |
|||
{ |
|||
<DynamicComponent Type="@hook.ComponentType" /> |
|||
} |
|||
} |
|||
@ -0,0 +1,39 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Threading.Tasks; |
|||
using Microsoft.AspNetCore.Components; |
|||
using Microsoft.Extensions.Options; |
|||
using Volo.Abp.Ui.LayoutHooks; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Components.LayoutHooks; |
|||
|
|||
public partial class LayoutHook : ComponentBase |
|||
{ |
|||
[Parameter] |
|||
public string Name { get; set; } |
|||
|
|||
[Parameter] |
|||
public string Layout { get; set; } |
|||
|
|||
[Inject] |
|||
protected IOptions<AbpLayoutHookOptions> LayoutHookOptions { get; set; } |
|||
|
|||
protected LayoutHookViewModel LayoutHookViewModel { get; private set; } |
|||
|
|||
protected override Task OnInitializedAsync() |
|||
{ |
|||
if (LayoutHookOptions.Value.Hooks.TryGetValue(Name, out var layoutHooks)) |
|||
{ |
|||
layoutHooks = layoutHooks |
|||
.WhereIf(string.IsNullOrWhiteSpace(Layout), x => x.Layout == Layout) |
|||
.ToList(); |
|||
} |
|||
|
|||
layoutHooks ??= new List<LayoutHookInfo>(); |
|||
|
|||
LayoutHookViewModel = new LayoutHookViewModel(layoutHooks.ToArray(), Layout); |
|||
|
|||
return Task.CompletedTask; |
|||
} |
|||
} |
|||
@ -0,0 +1,6 @@ |
|||
namespace Volo.Abp.AspNetCore.Components.Web.Theming.Layout; |
|||
|
|||
public static class StandardLayouts |
|||
{ |
|||
public const string Application = "Application"; |
|||
} |
|||
@ -1,7 +1,7 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook; |
|||
namespace Volo.Abp.Ui.LayoutHooks; |
|||
|
|||
public class AbpLayoutHookOptions |
|||
{ |
|||
@ -1,11 +1,11 @@ |
|||
using System; |
|||
|
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook; |
|||
namespace Volo.Abp.Ui.LayoutHooks; |
|||
|
|||
public class LayoutHookInfo |
|||
{ |
|||
/// <summary>
|
|||
/// ViewComponent type.
|
|||
/// Component type.
|
|||
/// </summary>
|
|||
public Type ComponentType { get; } |
|||
|
|||
@ -1,4 +1,4 @@ |
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook; |
|||
namespace Volo.Abp.Ui.LayoutHooks; |
|||
|
|||
public class LayoutHookViewModel |
|||
{ |
|||
@ -1,4 +1,4 @@ |
|||
namespace Volo.Abp.AspNetCore.Mvc.UI.Components.LayoutHook; |
|||
namespace Volo.Abp.Ui.LayoutHooks; |
|||
|
|||
public static class LayoutHooks |
|||
{ |
|||
Loading…
Reference in new issue