-
Notifications
You must be signed in to change notification settings - Fork 20
/
TabListDisplay.razor.cs
50 lines (43 loc) · 1.51 KB
/
TabListDisplay.razor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System.Collections.Immutable;
using Microsoft.AspNetCore.Components;
using Fluxor;
using Luthetus.Common.RazorLib.Dropdowns.States;
using Luthetus.Common.RazorLib.Dropdowns.Models;
using Luthetus.Common.RazorLib.Dynamics.Models;
using Luthetus.Common.RazorLib.Tabs.Models;
using Luthetus.Common.RazorLib.ComponentRenderers.Models;
using Luthetus.Common.RazorLib.Notifications.Models;
namespace Luthetus.Common.RazorLib.Tabs.Displays;
public partial class TabListDisplay : ComponentBase
{
[Inject]
private ICommonComponentRenderers CommonComponentRenderers { get; set; } = null!;
[Inject]
private IDispatcher Dispatcher { get; set; } = null!;
[Parameter, EditorRequired]
public ImmutableArray<ITab> TabList { get; set; } = ImmutableArray<ITab>.Empty;
[Parameter]
public string CssClassString { get; set; } = string.Empty;
public async Task NotifyStateChangedAsync()
{
await InvokeAsync(StateHasChanged);
}
private Task HandleTabButtonOnContextMenu(TabContextMenuEventArgs tabContextMenuEventArgs)
{
var dropdownRecord = new DropdownRecord(
TabContextMenu.ContextMenuEventDropdownKey,
tabContextMenuEventArgs.MouseEventArgs.ClientX,
tabContextMenuEventArgs.MouseEventArgs.ClientY,
typeof(TabContextMenu),
new Dictionary<string, object?>
{
{
nameof(TabContextMenu.TabContextMenuEventArgs),
tabContextMenuEventArgs
}
},
restoreFocusOnClose: null);
Dispatcher.Dispatch(new DropdownState.RegisterAction(dropdownRecord));
return Task.CompletedTask;
}
}