Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
55 changes: 55 additions & 0 deletions BootstrapBlazor.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<Solution>
<Folder Name="/configuration/">
<File Path=".editorconfig" />
<File Path=".gitignore" />
<File Path="exclusion.dic" />
<File Path="Framework.props" />
</Folder>
<Folder Name="/docs/">
<File Path="README.md" />
<File Path="README.zh-CN.md" />
</Folder>
<Folder Name="/localization/">
<File Path="localization/de.json" />
<File Path="localization/es.json" />
<File Path="localization/pt.json" />
<File Path="localization/th-TH.json" />
<File Path="localization/zh-TW.json" />
</Folder>
<Folder Name="/scripts/" />
<Folder Name="/scripts/linux/">
<File Path="scripts/linux/ba.blazor.service" />
<File Path="scripts/linux/deploy-blazor.sh" />
<File Path="scripts/linux/deploy.sh" />
<File Path="scripts/linux/nginx.conf" />
<File Path="scripts/linux/remove.sh" />
</Folder>
<Folder Name="/scripts/linux/cert/">
<File Path="scripts/linux/cert/blazor.zone.cer" />
<File Path="scripts/linux/cert/blazor.zone.key" />
<File Path="scripts/linux/cert/www.blazor.zone.cer" />
<File Path="scripts/linux/cert/www.blazor.zone.key" />
</Folder>
<Folder Name="/scripts/wasm/">
<File Path="scripts/wasm/sync.cmd" />
<File Path="scripts/wasm/sync.sh" />
</Folder>
<Folder Name="/scripts/windows/">
<File Path="scripts/windows/pack.cmd" />
<File Path="scripts/windows/push.cmd" />
<File Path="scripts/windows/push.ps1" />
</Folder>
<Folder Name="/src/">
<Project Path="src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj" />
<Project Path="src/BootstrapBlazor/BootstrapBlazor.csproj" />
</Folder>
<Folder Name="/test/">
<Project Path="test/UniTest.Sass/UniTest.Sass.csproj" />
<Project Path="test/UnitTest.Localization/UnitTest.Localization.csproj" />
<Project Path="test/UnitTest/UnitTest.csproj" />
<Project Path="test/UnitTestDocs/UnitTestDocs.csproj" />
</Folder>
<Folder Name="/tools/">
<Project Path="tools/Benchmarks/UnitTest.Benchmarks.csproj" />
</Folder>
</Solution>
10 changes: 8 additions & 2 deletions src/BootstrapBlazor/Components/Tab/Tab.razor
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ else
<div @attributes="@AdditionalAttributes" id="@Id" class="@ClassString" style="@StyleString">
<div class="tabs-header">
<div class="@WrapClassString">
<div class="nav-link-bar left" @onclick="@ClickPrevTab"><i class="@PreviousIcon"></i></div>
@if (ShowNavigatorButtons)
{
<div class="nav-link-bar left" @onclick="@ClickPrevTab"><i class="@PreviousIcon"></i></div>
}
<div class="tabs-nav-scroll">
<div role="tablist" class="tabs-nav">
<CascadingValue Value="this" IsFixed="true">
Expand Down Expand Up @@ -88,7 +91,10 @@ else
{
@ButtonTemplate
}
<div class="nav-link-bar right" @onclick="@ClickNextTab"><i class="@NextIcon"></i></div>
@if (ShowNavigatorButtons)
{
<div class="nav-link-bar right" @onclick="@ClickNextTab"><i class="@NextIcon"></i></div>
}
@if (ShouldShowExtendButtons())
{
<div class="nav-link-bar dropdown dropdown-toggle" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Expand Down
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 @@ -125,6 +125,12 @@ public partial class Tab : IHandlerException
[Parameter]
public bool ShowExtendButtons { get; set; }

/// <summary>
/// 获得/设置 是否显示导航按钮 默认为 true 显示
/// </summary>
[Parameter]
public bool ShowNavigatorButtons { get; set; } = true;

/// <summary>
/// 获得/设置 点击 TabItem 时是否自动导航 默认为 false 不导航
/// </summary>
Expand Down
25 changes: 25 additions & 0 deletions test/UnitTest/Components/TabTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,31 @@ public void ButtonTemplate_Ok()
cut.Contains("<div>test-button</div>");
}

[Fact]
public void ShowNavigatorButtons_Ok()
{
var cut = Context.RenderComponent<Tab>(pb =>
{
pb.Add(a => a.AdditionalAssemblies, new Assembly[] { GetType().Assembly });
pb.Add(a => a.ShowNavigatorButtons, true);
pb.AddChildContent<TabItem>(pb =>
{
pb.Add(a => a.Text, "Tab1");
pb.Add(a => a.Url, "/Cat");
});
});

var links = cut.FindAll(".nav-link-bar");
Assert.Equal(2, links.Count);

cut.SetParametersAndRender(pb =>
{
pb.Add(a => a.ShowNavigatorButtons, false);
});
links = cut.FindAll(".nav-link-bar");
Assert.Empty(links);
}

[Fact]
public void Text_Ok()
{
Expand Down