From c4fd31d95e16fc9d727cab2b039e7d41e4e1f353 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 18 Feb 2025 11:49:25 +0800 Subject: [PATCH 1/4] feat(Tab): add ShowActiveBar parameter --- src/BootstrapBlazor/Components/Tab/Tab.razor | 2 +- src/BootstrapBlazor/Components/Tab/Tab.razor.cs | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/Tab/Tab.razor b/src/BootstrapBlazor/Components/Tab/Tab.razor index f67b68edf5f..98e1797da09 100644 --- a/src/BootstrapBlazor/Components/Tab/Tab.razor +++ b/src/BootstrapBlazor/Components/Tab/Tab.razor @@ -81,7 +81,7 @@ else
} - @if (!IsCard && !IsBorderCard) + @if (!IsCard && !IsBorderCard && ShowActiveBar) {
} diff --git a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs index 205be895551..b685c853ab9 100644 --- a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs +++ b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs @@ -131,6 +131,12 @@ public partial class Tab : IHandlerException [Parameter] public bool ShowNavigatorButtons { get; set; } = true; + /// + /// 获得/设置 是否显示活动标签 默认为 true 显示 + /// + [Parameter] + public bool ShowActiveBar { get; set; } = true; + /// /// 获得/设置 点击 TabItem 时是否自动导航 默认为 false 不导航 /// From 0c006cade157d586e023a6971d34d514a2d5b976 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 18 Feb 2025 11:49:30 +0800 Subject: [PATCH 2/4] =?UTF-8?q?test:=20=E5=A2=9E=E5=8A=A0=E5=8D=95?= =?UTF-8?q?=E5=85=83=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/UnitTest/Components/TabTest.cs | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/UnitTest/Components/TabTest.cs b/test/UnitTest/Components/TabTest.cs index 2def43335f9..426f647340f 100644 --- a/test/UnitTest/Components/TabTest.cs +++ b/test/UnitTest/Components/TabTest.cs @@ -655,6 +655,28 @@ public void ShowNavigatorButtons_Ok() Assert.Empty(links); } + [Fact] + public void ShowActiveBar_Ok() + { + var cut = Context.RenderComponent(pb => + { + pb.Add(a => a.AdditionalAssemblies, new Assembly[] { GetType().Assembly }); + pb.Add(a => a.ShowActiveBar, true); + pb.AddChildContent(pb => + { + pb.Add(a => a.Text, "Tab1"); + pb.Add(a => a.Url, "/Cat"); + }); + }); + cut.Contains("
"); + + cut.SetParametersAndRender(pb => + { + pb.Add(a => a.ShowActiveBar, false); + }); + cut.DoesNotContain("
"); + } + [Fact] public void Text_Ok() { From 94610b952607534cac53efa47e7009b43b186680 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 18 Feb 2025 11:53:35 +0800 Subject: [PATCH 3/4] =?UTF-8?q?doc:=20=E6=9B=B4=E6=96=B0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Tab/Tab.razor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs index b685c853ab9..f3366c1c241 100644 --- a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs +++ b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs @@ -126,7 +126,7 @@ public partial class Tab : IHandlerException public bool ShowExtendButtons { get; set; } /// - /// 获得/设置 是否显示导航按钮 默认为 true 显示 + /// 获得/设置 是否显示前后导航按钮 默认为 true 显示 /// [Parameter] public bool ShowNavigatorButtons { get; set; } = true; From 1d96f5d4df4f2f6018494d209bd5c1af58df60fe Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Tue, 18 Feb 2025 11:53:45 +0800 Subject: [PATCH 4/4] =?UTF-8?q?doc:=20=E5=A2=9E=E5=8A=A0=E6=96=B0=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E8=AF=B4=E6=98=8E=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/Samples/Tabs.razor.cs | 17 ++++++++++++++++- src/BootstrapBlazor.Server/Locales/en-US.json | 2 ++ src/BootstrapBlazor.Server/Locales/zh-CN.json | 2 ++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/Tabs.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/Tabs.razor.cs index 656ca3db445..ad0babd0d43 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Tabs.razor.cs +++ b/src/BootstrapBlazor.Server/Components/Samples/Tabs.razor.cs @@ -226,6 +226,22 @@ private AttributeItem[] GetAttributes() => DefaultValue = "false" }, new() + { + Name = "ShowExtendButtons", + Description = Localizer["TabAttrShowNavigatorButtons"].Value, + Type = "boolean", + ValueList = "true|false", + DefaultValue = "true" + }, + new() + { + Name = "ShowExtendButtons", + Description = Localizer["TabAttrShowActiveBar"].Value, + Type = "boolean", + ValueList = "true|false", + DefaultValue = "true" + }, + new() { Name = "ClickTabToNavigation", Description = Localizer["TabAtt6ClickTabToNavigation"].Value, @@ -369,7 +385,6 @@ private AttributeItem[] GetAttributes() => /// private MethodItem[] GetMethods() => [ - new MethodItem() { Name = "AddTab", diff --git a/src/BootstrapBlazor.Server/Locales/en-US.json b/src/BootstrapBlazor.Server/Locales/en-US.json index 867cde16d73..f1137fb0d1f 100644 --- a/src/BootstrapBlazor.Server/Locales/en-US.json +++ b/src/BootstrapBlazor.Server/Locales/en-US.json @@ -2085,6 +2085,8 @@ "TabAtt3IsOnlyRenderActiveTab": "Whether to render only Active labels", "TabAtt4ShowClose": "Whether to display the close button", "TabAtt5ShowExtendButtons": "Whether to display the extension button", + "TabAttShowNavigatorButtons": "Whether to display the previous and next navigation buttons", + "TabAttShowActiveBar": "Whether to display active bar", "TabAtt6ClickTabToNavigation": "Whether to navigate when you click on the title", "TabAtt7Placement": "Set the label position", "TabAtt8Height": "Set the label height", diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json index 6603ae440b0..30780cc1212 100644 --- a/src/BootstrapBlazor.Server/Locales/zh-CN.json +++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json @@ -2085,6 +2085,8 @@ "TabAtt3IsOnlyRenderActiveTab": "是否仅渲染 Active 标签", "TabAtt4ShowClose": "是否显示关闭按钮", "TabAtt5ShowExtendButtons": "是否显示扩展按钮", + "TabAttShowNavigatorButtons": "是否显示前后导航按钮", + "TabAttShowActiveBar": "是否显示活动标签", "TabAtt6ClickTabToNavigation": "点击标题时是否导航", "TabAtt7Placement": "设置标签位置", "TabAtt8Height": "设置标签高度",