diff --git a/src/BootstrapBlazor.Server/Components/Samples/ContextMenus.razor b/src/BootstrapBlazor.Server/Components/Samples/ContextMenus.razor
index ad70bd22cb9..5642f1eddea 100644
--- a/src/BootstrapBlazor.Server/Components/Samples/ContextMenus.razor
+++ b/src/BootstrapBlazor.Server/Components/Samples/ContextMenus.razor
@@ -53,3 +53,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/BootstrapBlazor.Server/Components/Samples/ContextMenus.razor.cs b/src/BootstrapBlazor.Server/Components/Samples/ContextMenus.razor.cs
index 4333decc722..ca63d8acc29 100644
--- a/src/BootstrapBlazor.Server/Components/Samples/ContextMenus.razor.cs
+++ b/src/BootstrapBlazor.Server/Components/Samples/ContextMenus.razor.cs
@@ -7,6 +7,10 @@ public partial class ContextMenus
{
private List> TreeItems { get; set; } = TreeFoo.GetTreeItems();
+ private ConsoleLogger _callbackLogger = default!;
+
+ private ConsoleLogger _disabledLogger = default!;
+
private static Task OnCopy(ContextMenuItem item, object value)
{
return Task.CompletedTask;
@@ -31,4 +35,24 @@ protected override void OnInitialized()
Foo = Foo.Generate(LocalizerFoo);
Items = Foo.GenerateFoo(LocalizerFoo);
}
+
+ private Task OnBeforeShowCallback(object? item)
+ {
+ if (item is TreeFoo foo)
+ {
+ _callbackLogger.Log($"{foo.Text} trigger");
+ }
+ return Task.CompletedTask;
+ }
+
+ private bool OnDisabledCallback(ContextMenuItem item, object? context)
+ {
+ var ret = false;
+ if (context is Foo foo)
+ {
+ ret = foo.Id == 1;
+ _disabledLogger.Log($"{foo.Name} trigger {item.Text} Disabled: {ret}");
+ }
+ return ret;
+ }
}
diff --git a/src/BootstrapBlazor.Server/Locales/en-US.json b/src/BootstrapBlazor.Server/Locales/en-US.json
index dbe7513a698..ce2fc59d1c4 100644
--- a/src/BootstrapBlazor.Server/Locales/en-US.json
+++ b/src/BootstrapBlazor.Server/Locales/en-US.json
@@ -6042,7 +6042,11 @@
"ContextMenuTableTitle": "Table",
"ContextMenuTableIntro": "Right click on the Table
to pop up a context menu",
"ContextMenuTreeTitle": "Tree",
- "ContextMenuTreeIntro": "Right click on the Tree
to pop up a context menu"
+ "ContextMenuTreeIntro": "Right click on the Tree
to pop up a context menu",
+ "ContextMenuCallbackTitle": "ContextMenu Callback",
+ "ContextMenuCallbackIntro": "By setting the ContextMenu
component parameter OnBeforeShowCallback
, you can get the callback event before the right-click menu pops up, which can be used for data preparation",
+ "ContextMenuDisabledTitle": "OnDisabledCallback",
+ "ContextMenuDisabledIntro": "By setting the ContextMenuItem
component parameter OnDisabledCallback
callback method, you can set whether the current right-click option is disabled."
},
"BootstrapBlazor.Server.Components.Samples.DockViews.Index": {
"DockViewTitle": "DockView",
diff --git a/src/BootstrapBlazor.Server/Locales/zh-CN.json b/src/BootstrapBlazor.Server/Locales/zh-CN.json
index 8a82345a873..6b41e59614a 100644
--- a/src/BootstrapBlazor.Server/Locales/zh-CN.json
+++ b/src/BootstrapBlazor.Server/Locales/zh-CN.json
@@ -6042,7 +6042,11 @@
"ContextMenuTableTitle": "Table 组件",
"ContextMenuTableIntro": "点击 Table
组件行数据右键,弹出上下文关联菜单",
"ContextMenuTreeTitle": "Tree 组件",
- "ContextMenuTreeIntro": "点击 Tree
组件行数据右键,弹出上下文关联菜单"
+ "ContextMenuTreeIntro": "点击 Tree
组件行数据右键,弹出上下文关联菜单",
+ "ContextMenuCallbackTitle": "ContextMenu 回调",
+ "ContextMenuCallbackIntro": "通过设置 ContextMenu
组件参数 OnBeforeShowCallback
获得右键菜单弹出前回调事件,可用于数据准备工作",
+ "ContextMenuDisabledTitle": "禁止回调方法",
+ "ContextMenuDisabledIntro": "通过设置 ContextMenuItem
组件参数 OnDisabledCallback
回调方法可用于设置当前右键选项是否禁用逻辑"
},
"BootstrapBlazor.Server.Components.Samples.DockViews.Index": {
"DockViewTitle": "DockView 可停靠视图",
diff --git a/src/BootstrapBlazor/BootstrapBlazor.csproj b/src/BootstrapBlazor/BootstrapBlazor.csproj
index cd098e01e96..137af407982 100644
--- a/src/BootstrapBlazor/BootstrapBlazor.csproj
+++ b/src/BootstrapBlazor/BootstrapBlazor.csproj
@@ -1,7 +1,7 @@
- 8.8.4-beta02
+ 8.8.4-beta03
diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor
index eaadf1deab7..d140b3ead61 100644
--- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor
+++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor
@@ -6,4 +6,15 @@
@ChildContent
+
+ @foreach (var item in _contextMenuItems)
+ {
+ var disabled = GetItemTriggerClick(item);
+
+
+ @item.Text
+
+ }
+
diff --git a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs
index 00a5e1d7114..d53b39ea1ba 100644
--- a/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs
+++ b/src/BootstrapBlazor/Components/ContextMenu/ContextMenu.razor.cs
@@ -11,6 +11,18 @@ namespace BootstrapBlazor.Components;
///
public partial class ContextMenu
{
+ ///
+ /// 获得/设置 是否显示阴影 默认 true
+ ///
+ [Parameter]
+ public bool ShowShadow { get; set; } = true;
+
+ ///
+ /// 获得/设置 弹出前回调方法 默认 null
+ ///
+ [Parameter]
+ public Func