From 4b9419a60f54624d602b07a88da38bfc96abff47 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Mar 2025 15:12:11 +0800 Subject: [PATCH 1/6] =?UTF-8?q?style:=20=E5=BE=AE=E8=B0=83=20divider=20?= =?UTF-8?q?=E9=97=B4=E9=9A=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/ContextMenu/ContextMenu.razor.scss | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.scss b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.scss index 3d8e6cc4eef..cdcf0917236 100644 --- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.scss +++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.scss @@ -1,4 +1,4 @@ -.bb-cm { +.bb-cm { --bb-cm-icon-min-width: #{$bb-cm-icon-min-width}; --bb-cm-icon-min-height: #{$bb-cm-icon-min-height}; z-index: 1200; @@ -10,6 +10,6 @@ } .divider { - margin: 0.5rem 0; + margin: 0.25rem 0; } } From e3a9569a6e7f7dc20a16231026d952d473ebac1d Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Mar 2025 15:12:27 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20ShowContextMen?= =?UTF-8?q?uFullScreen=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Tab/Tab.razor | 5 +++++ .../Components/Tab/Tab.razor.cs | 20 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/Tab/Tab.razor b/src/BootstrapBlazor/Components/Tab/Tab.razor index a9de8d62912..4d41573577b 100644 --- a/src/BootstrapBlazor/Components/Tab/Tab.razor +++ b/src/BootstrapBlazor/Components/Tab/Tab.razor @@ -20,6 +20,11 @@ else if (ShowContextMenu) + @if (ShowContextMenuFullScreen) + { + + + } @if (ContextMenuTemplate != null) { @ContextMenuTemplate(this) diff --git a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs index 21610165ab0..26fc0fa9d50 100644 --- a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs +++ b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs @@ -114,6 +114,12 @@ public partial class Tab : IHandlerException [Parameter] public bool ShowFullScreen { get; set; } + /// + /// Gets or sets whether show the full screen button on context menu. Default is true. + /// + [Parameter] + public bool ShowContextMenuFullScreen { get; set; } = true; + /// /// 关闭标签页回调方法 /// @@ -433,6 +439,10 @@ public partial class Tab : IHandlerException [Inject, NotNull] private DialogService? DialogService { get; set; } + [Inject] + [NotNull] + private FullScreenService? FullScreenService { get; set; } + private ContextMenuZone? _contextMenuZone; private ConcurrentDictionary LazyTabCache { get; } = new(); @@ -1016,7 +1026,7 @@ public async Task DragItemCallback(int originIndex, int currentIndex) } } - private string? GetIdByTabItem(TabItem item) => ComponentIdGenerator.Generate(item); + private string GetIdByTabItem(TabItem item) => ComponentIdGenerator.Generate(item); private async Task OnRefreshAsync() { @@ -1075,6 +1085,14 @@ private Task OnCloseAll(ContextMenuItem item, object? context) return Task.CompletedTask; } + private async Task OnFullScreen(ContextMenuItem item, object? context) + { + if (context is TabItem tabItem) + { + await FullScreenService.ToggleById(GetIdByTabItem(tabItem)); + } + } + private async Task OnContextMenu(MouseEventArgs e, TabItem item) { if (_contextMenuZone != null) From 997d52124761584a22f4fab90d8272f63e6fc4b2 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Mar 2025 15:19:47 +0800 Subject: [PATCH 3/6] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=20ContextMenuFul?= =?UTF-8?q?lScreenIcon=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Tab/Tab.razor | 2 +- src/BootstrapBlazor/Components/Tab/Tab.razor.cs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/BootstrapBlazor/Components/Tab/Tab.razor b/src/BootstrapBlazor/Components/Tab/Tab.razor index 4d41573577b..bc398dd2b8a 100644 --- a/src/BootstrapBlazor/Components/Tab/Tab.razor +++ b/src/BootstrapBlazor/Components/Tab/Tab.razor @@ -23,7 +23,7 @@ else if (ShowContextMenu) @if (ShowContextMenuFullScreen) { - + } @if (ContextMenuTemplate != null) { diff --git a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs index 26fc0fa9d50..13f511925f1 100644 --- a/src/BootstrapBlazor/Components/Tab/Tab.razor.cs +++ b/src/BootstrapBlazor/Components/Tab/Tab.razor.cs @@ -407,6 +407,12 @@ public partial class Tab : IHandlerException [Parameter] public string? ContextMenuCloseAllIcon { get; set; } + /// + /// Gets or sets the icon of tab item context menu full screen button. Default is null. + /// + [Parameter] + public string? ContextMenuFullScreenIcon { get; set; } + /// /// Gets or sets before popup context menu callback. Default is null. /// @@ -500,6 +506,7 @@ protected override void OnParametersSet() ContextMenuCloseIcon ??= IconTheme.GetIconByKey(ComponentIcons.TabContextMenuCloseIcon); ContextMenuCloseOtherIcon ??= IconTheme.GetIconByKey(ComponentIcons.TabContextMenuCloseOtherIcon); ContextMenuCloseAllIcon ??= IconTheme.GetIconByKey(ComponentIcons.TabContextMenuCloseAllIcon); + ContextMenuFullScreenIcon ??= IconTheme.GetIconByKey(ComponentIcons.TabContextMenuFullScreenIcon); if (AdditionalAssemblies is null) { From e8fd1e5bb433c0eb8ac0965a71d496c580606250 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Mar 2025 15:20:06 +0800 Subject: [PATCH 4/6] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=85=A8?= =?UTF-8?q?=E5=B1=8F=E5=8F=B3=E9=94=AE=E8=8F=9C=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Enums/ComponentIcons.cs | 5 +++++ src/BootstrapBlazor/Icons/BootstrapIcons.cs | 1 + src/BootstrapBlazor/Icons/FontAwesomeIcons.cs | 1 + src/BootstrapBlazor/Icons/MaterialDesignIcons.cs | 1 + src/BootstrapBlazor/Locales/en.json | 3 ++- src/BootstrapBlazor/Locales/zh.json | 3 ++- 6 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor/Enums/ComponentIcons.cs b/src/BootstrapBlazor/Enums/ComponentIcons.cs index 3b417961e69..a401bf07393 100644 --- a/src/BootstrapBlazor/Enums/ComponentIcons.cs +++ b/src/BootstrapBlazor/Enums/ComponentIcons.cs @@ -730,6 +730,11 @@ public enum ComponentIcons /// TabContextMenuCloseAllIcon, + /// + /// Tab 组件 TabContextMenuFullScreenIcon 属性图标 + /// + TabContextMenuFullScreenIcon, + /// /// Timer 组件 Icon 属性图标 /// diff --git a/src/BootstrapBlazor/Icons/BootstrapIcons.cs b/src/BootstrapBlazor/Icons/BootstrapIcons.cs index 1b420a62a6c..641d0182b37 100644 --- a/src/BootstrapBlazor/Icons/BootstrapIcons.cs +++ b/src/BootstrapBlazor/Icons/BootstrapIcons.cs @@ -90,6 +90,7 @@ internal static class BootstrapIcons { ComponentIcons.TabContextMenuCloseIcon, "bi bi-x" }, { ComponentIcons.TabContextMenuCloseOtherIcon, "bi bi-arrow" }, { ComponentIcons.TabContextMenuCloseAllIcon, "bi bi-arrow-left-right" }, + { ComponentIcons.TabContextMenuFullScreenIcon, "bi bi-arrows-fullscreen" }, { ComponentIcons.LogoutLinkIcon, "bi bi-box-arrow-right" }, diff --git a/src/BootstrapBlazor/Icons/FontAwesomeIcons.cs b/src/BootstrapBlazor/Icons/FontAwesomeIcons.cs index 4788bb160bd..893d038e89a 100644 --- a/src/BootstrapBlazor/Icons/FontAwesomeIcons.cs +++ b/src/BootstrapBlazor/Icons/FontAwesomeIcons.cs @@ -90,6 +90,7 @@ internal static class FontAwesomeIcons { ComponentIcons.TabContextMenuCloseIcon, "fa-fw fa-solid fa-xmark" }, { ComponentIcons.TabContextMenuCloseOtherIcon, "fa-fw fa-solid fa-left-right" }, { ComponentIcons.TabContextMenuCloseAllIcon, "fa-fw fa-solid fa-arrows-left-right-to-line" }, + { ComponentIcons.TabContextMenuFullScreenIcon, "fa-fw fa-solid fa-maximize" }, { ComponentIcons.LogoutLinkIcon, "fa-solid fa-key" }, diff --git a/src/BootstrapBlazor/Icons/MaterialDesignIcons.cs b/src/BootstrapBlazor/Icons/MaterialDesignIcons.cs index 42ebb0881d9..a75eb1597ea 100644 --- a/src/BootstrapBlazor/Icons/MaterialDesignIcons.cs +++ b/src/BootstrapBlazor/Icons/MaterialDesignIcons.cs @@ -90,6 +90,7 @@ internal static class MaterialDesignIcons { ComponentIcons.TabContextMenuCloseIcon, "mdi mdi-close" }, { ComponentIcons.TabContextMenuCloseOtherIcon, "mdi mdi-menu" }, { ComponentIcons.TabContextMenuCloseAllIcon, "mdi mdi-arrow-left-right-bold" }, + { ComponentIcons.TabContextMenuFullScreenIcon, "mdi mdi-arrow-expand-all" }, { ComponentIcons.LogoutLinkIcon, "mdi mdi-logout" }, diff --git a/src/BootstrapBlazor/Locales/en.json b/src/BootstrapBlazor/Locales/en.json index 847e2e1a738..c2d030ddbe0 100644 --- a/src/BootstrapBlazor/Locales/en.json +++ b/src/BootstrapBlazor/Locales/en.json @@ -182,7 +182,8 @@ "ContextRefresh": "Refresh", "ContextClose": "Close", "ContextCloseOther": "Close Other Tabs", - "ContextCloseAll": "Close All Tabs" + "ContextCloseAll": "Close All Tabs", + "ContextFullScreen": "Full screen" }, "BootstrapBlazor.Components.MultiFilter": { "MultiFilterSearchPlaceHolderText": "Please enter ...", diff --git a/src/BootstrapBlazor/Locales/zh.json b/src/BootstrapBlazor/Locales/zh.json index 22af6c45ff4..219dd19ade3 100644 --- a/src/BootstrapBlazor/Locales/zh.json +++ b/src/BootstrapBlazor/Locales/zh.json @@ -182,7 +182,8 @@ "ContextRefresh": "刷新", "ContextClose": "关闭", "ContextCloseOther": "关闭其他", - "ContextCloseAll": "关闭全部" + "ContextCloseAll": "关闭全部", + "ContextFullScreen": "全屏" }, "BootstrapBlazor.Components.MultiFilter": { "MultiFilterSearchPlaceHolderText": "请输入 ...", From 71d28eb50b06675e3ef5ade12ef0534a6feba411 Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Mar 2025 15:24:13 +0800 Subject: [PATCH 5/6] =?UTF-8?q?revert:=20=E6=9B=B4=E6=96=B0=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.Server/Components/Samples/Tabs.razor | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/BootstrapBlazor.Server/Components/Samples/Tabs.razor b/src/BootstrapBlazor.Server/Components/Samples/Tabs.razor index 4e4720d6cfc..1be6b06f553 100644 --- a/src/BootstrapBlazor.Server/Components/Samples/Tabs.razor +++ b/src/BootstrapBlazor.Server/Components/Samples/Tabs.razor @@ -500,9 +500,8 @@ private void Navigation()

@((MarkupString)Localizer["TabsContextMenuDesc"].Value)

- - + +
@Localizer["TabItem1Content"]
From fc025bcb671917b7ce429702327f3afae089e75d Mon Sep 17 00:00:00 2001 From: Argo Zhang Date: Fri, 28 Mar 2025 15:24:20 +0800 Subject: [PATCH 6/6] =?UTF-8?q?test:=20=E6=9B=B4=E6=96=B0=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 | 1 + 1 file changed, 1 insertion(+) diff --git a/test/UnitTest/Components/TabTest.cs b/test/UnitTest/Components/TabTest.cs index 99df42b4fc2..3602fd93a3b 100644 --- a/test/UnitTest/Components/TabTest.cs +++ b/test/UnitTest/Components/TabTest.cs @@ -33,6 +33,7 @@ public async Task ContextMenu_Ok() pb.AddChildContent(pb => { pb.Add(a => a.ShowContextMenu, true); + pb.Add(a => a.ShowContextMenuFullScreen, true); pb.AddChildContent(pb => { pb.Add(a => a.IsDisabled, true);