Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
display: inline-block;
}

:not(:root):fullscreen {
:fullscreen {
.bb-fs-on {
display: inline-block;
}
Expand Down
5 changes: 2 additions & 3 deletions src/BootstrapBlazor/Components/Tab/Tab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ else
@if (ShowFullscreenToolbarButton)
{
<div class="tabs-nav-toolbar-button tabs-nav-toolbar-fs">
<FullScreenButton TargetId="@Id"
Icon="@FullscreenToolbarButtonIcon"
<FullScreenButton Icon="@FullscreenToolbarButtonIcon"
TooltipText="@FullscreenToolbarTooltipText"
TooltipPlacement="Placement.Bottom" TooltipTrigger="hover"></FullScreenButton>
</div>
Expand Down Expand Up @@ -194,7 +193,7 @@ else
{
@if (ShowFullScreen && item.ShowFullScreen)
{
<FullScreenButton TargetId="@GetIdByTabItem(item)"></FullScreenButton>
<FullScreenButton></FullScreenButton>
}
@if (ShowClose && item.Closable)
{
Expand Down
7 changes: 1 addition & 6 deletions src/BootstrapBlazor/Components/Tab/Tab.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1059,8 +1059,6 @@ public async Task DragItemCallback(int originIndex, int currentIndex)
}
}

private string GetIdByTabItem(TabItem item) => ComponentIdGenerator.Generate(item);

private async Task OnRefreshAsync()
{
// refresh the active tab item
Expand Down Expand Up @@ -1120,10 +1118,7 @@ private Task OnCloseAll(ContextMenuItem item, object? context)

private async Task OnFullScreen(ContextMenuItem item, object? context)
{
if (context is TabItem tabItem)
{
await FullScreenService.ToggleById(GetIdByTabItem(tabItem));
}
await FullScreenService.ToggleById();
}

private async Task OnContextMenu(MouseEventArgs e, TabItem item)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ public static class FullScreenServiceExtensions
/// <param name="id"></param>
/// <param name="service"></param>
/// <returns></returns>
public static Task ToggleById(this FullScreenService service, string id) => service.Toggle(new() { Id = id });
public static Task ToggleById(this FullScreenService service, string? id = null) => service.Toggle(new() { Id = id });
}
5 changes: 2 additions & 3 deletions test/UnitTest/Services/FullScreenServiceTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,13 @@ public async Task ToggleById_Ok()
var cut = Context.Render(builder =>
{
builder.OpenElement(0, "div");
builder.AddAttribute(1, "id", "test-id");
builder.CloseElement();

builder.OpenComponent<MockFullScreen>(0);
builder.CloseComponent();
});
var fs = cut.FindComponent<MockFullScreen>();
await cut.InvokeAsync(() => fs.Instance.TestById("test-id"));
await cut.InvokeAsync(() => fs.Instance.TestById());
}

[Fact]
Expand Down Expand Up @@ -105,7 +104,7 @@ protected override void BuildRenderTree(RenderTreeBuilder builder)

public Task Test(ElementReference ele) => FullScreenService.ToggleByElement(ele);

public Task TestById(string id) => FullScreenService.ToggleById(id);
public Task TestById() => FullScreenService.ToggleById();

public Task Toggle() => FullScreenService.Toggle();
}
Expand Down