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
4 changes: 2 additions & 2 deletions src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup Condition="'$(VisualStudioVersion)' == '17.0'">
<Version>9.12.2-beta02</Version>
<Version>9.12.2-beta03</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(VisualStudioVersion)' == '18.0'">
<Version>10.0.0-rc.2.2.4</Version>
<Version>10.0.0-rc.2.2.5</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/Components/Layout/Layout.razor
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
ShowExtendButtons="ShowTabExtendButtons" ShowClose="ShowTabItemClose" AllowDrag="AllowDragTab"
DefaultUrl="@TabDefaultUrl" ExcludeUrls="@ExcludeUrls" IsOnlyRenderActiveTab="IsOnlyRenderActiveTab"
TabStyle="TabStyle" ShowToolbar="@ShowToolbar" ToolbarTemplate="@ToolbarTemplate"
ShowContextMenu="ShowTabContextMenu"
ShowContextMenu="ShowTabContextMenu" OnTabHeaderTextLocalizer="OnTabHeaderTextLocalizer"
BeforeContextMenuTemplate="@BeforeTabContextMenuTemplate" ContextMenuTemplate="@TabContextMenuTemplate"
ContextMenuRefreshIcon="@TabContextMenuRefreshIcon" ContextMenuCloseIcon="@TabContextMenuCloseIcon"
ContextMenuCloseOtherIcon="@TabContextMenuCloseOtherIcon" ContextMenuCloseAllIcon="@TabContextMenuCloseAllIcon"
Expand Down
6 changes: 6 additions & 0 deletions src/BootstrapBlazor/Components/Layout/Layout.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ public partial class Layout : IHandlerException, ITabHeader
{
private bool IsSmallScreen { get; set; }

/// <summary>
/// 获得/设置 Tab 标签头文本本地化回调方法
/// </summary>
[Parameter]
public Func<string?, string?>? OnTabHeaderTextLocalizer { get; set; }

/// <summary>
/// Gets or sets the tab style. Default is <see cref="TabStyle.Default"/>.
/// </summary>
Expand Down
13 changes: 3 additions & 10 deletions src/BootstrapBlazor/Components/Tab/Tab.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@ public partial class Tab
/// 获得/设置 Gets or sets a collection of additional assemblies that should be searched for components that can match URIs.
/// </summary>
[Parameter]
[NotNull]
public IEnumerable<Assembly>? AdditionalAssemblies { get; set; }

/// <summary>
Expand Down Expand Up @@ -529,15 +528,6 @@ protected override void OnParametersSet()
ContextMenuCloseAllIcon ??= IconTheme.GetIconByKey(ComponentIcons.TabContextMenuCloseAllIcon);
ContextMenuFullScreenIcon ??= IconTheme.GetIconByKey(ComponentIcons.TabContextMenuFullScreenIcon);

if (AdditionalAssemblies is null)
{
var entryAssembly = Assembly.GetEntryAssembly();
if (entryAssembly is not null)
{
AdditionalAssemblies = [entryAssembly];
}
}

if (Placement != Placement.Top && TabStyle == TabStyle.Chrome)
{
TabStyle = TabStyle.Default;
Expand Down Expand Up @@ -814,8 +804,11 @@ public void AddTab(string url, string text, string? icon = null, bool active = t
StateHasChanged();
}

private static List<Assembly> GetAdditionalAssemblies() => [Assembly.GetEntryAssembly()!];

private void AddTabItem(string url)
{
AdditionalAssemblies ??= GetAdditionalAssemblies();
var parameters = new Dictionary<string, object?>
{
{ nameof(TabItem.Url), url }
Expand Down
Loading