Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 3 additions & 0 deletions src/BootstrapBlazor.Server/Components/Samples/Tabs.razor
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,7 @@ private void Navigation()
<Tab IsCard="true" ShowClose="true" TabStyle="TabStyle.Chrome" ShowToolbar="true" @ref="_tab">
<TabItem Text="@Localizer["TabItem1Text"]" Icon="fa-solid fa-user">
<div>@Localizer["TabItem1Content"]</div>
<Counter></Counter>
</TabItem>
<TabItem Text="@Localizer["TabItem2Text"]" Icon="fa-solid fa-gauge-high">
<div>@Localizer["TabItem2Content"]</div>
Expand All @@ -513,6 +514,8 @@ private void Navigation()
</TabItem>
</Tab>
<ContextMenu>
<ContextMenuItem Icon="fa-solid fa-rotate-right" Text="@Localizer["ContextRefresh"]" OnClick="OnRefrsh"></ContextMenuItem>
<ContextMenuDivider></ContextMenuDivider>
<ContextMenuItem Icon="fa-solid fa-xmark" Text="@Localizer["ContextClose"]" OnClick="OnClose"></ContextMenuItem>
<ContextMenuItem Icon="fa-solid fa-left-right" Text="@Localizer["ContextCloseOther"]" OnClick="OnCloseOther"></ContextMenuItem>
<ContextMenuItem Icon="fa-solid fa-arrows-left-right-to-line" Text="@Localizer["ContextCloseAll"]" OnClick="OnCloseAll"></ContextMenuItem>
Expand Down
9 changes: 9 additions & 0 deletions src/BootstrapBlazor.Server/Components/Samples/Tabs.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,15 @@ private Task OnSetTitle(string text)
[NotNull]
private Tab? _tab = null;

private Task OnRefrsh(ContextMenuItem item, object? context)
{
if (context is TabItem tabItem)
{
_tab.Refresh(tabItem);
}
return Task.CompletedTask;
}

private async Task OnClose(ContextMenuItem item, object? context)
{
if (context is TabItem tabItem)
Expand Down
1 change: 1 addition & 0 deletions src/BootstrapBlazor.Server/Locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -2133,6 +2133,7 @@
"AttributeFullscreenToolbarButtonIcon": "Toolbar full screen button icon",
"TabsToolbarDesc": "After clicking the button, the counter value increases, and clicking the <b>Refresh</b> button on the toolbar will reset the counter.",
"AttributeOnToolbarRefreshCallback": "Click the toolbar refresh button callback method",
"ContextRefresh": "Refresh",
"ContextClose": "Close",
"ContextCloseOther": "Close Other Tabs",
"ContextCloseAll": "Close All Tabs",
Expand Down
1 change: 1 addition & 0 deletions src/BootstrapBlazor.Server/Locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -2133,6 +2133,7 @@
"AttributeFullscreenToolbarButtonIcon": "工具栏全屏按钮图标",
"TabsToolbarDesc": "点击按钮计数器数值增加后,点击工具栏的 <b>刷新</b> 按钮计数器清零",
"AttributeOnToolbarRefreshCallback": "点击工具栏刷新按钮回调方法",
"ContextRefresh": "刷新",
"ContextClose": "关闭",
"ContextCloseOther": "关闭其他",
"ContextCloseAll": "关闭全部",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
min-height: var(--bb-cm-icon-min-height);
display: inline-block;
}

.divider {
margin: 0.5rem 0;
}
}
6 changes: 6 additions & 0 deletions src/BootstrapBlazor/Components/Tab/Tab.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -958,6 +958,12 @@
}
}

/// <summary>
/// Refresh the tab item method
/// </summary>
/// <param name="item"></param>
public void Refresh(TabItem item) => item.Refresh(_cache);

Check warning on line 965 in src/BootstrapBlazor/Components/Tab/Tab.razor.cs

View check run for this annotation

Codecov / codecov/patch

src/BootstrapBlazor/Components/Tab/Tab.razor.cs#L965

Added line #L965 was not covered by tests

/// <summary>
/// <inheritdoc/>
/// </summary>
Expand Down