Skip to content

Commit 233ea83

Browse files
authored
doc(PopConfirmButton): add hover focus sample documentation (#4735)
* doc: 更新注释文档 * doc: 增加 Trigger 示例 * doc: 增加本地化
1 parent deaccd5 commit 233ea83

File tree

5 files changed

+48
-3
lines changed

5 files changed

+48
-3
lines changed

src/BootstrapBlazor.Server/Components/Samples/PopoverConfirms.razor

+17
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,23 @@ private Func&lt;Task&gt;? OnConfirmAsync { get; set; }</Pre>
166166
</PopConfirmButton>
167167
</DemoBlock>
168168

169+
<DemoBlock Title="@Localizer["PopoverConfirmsTriggerTitle"]"
170+
Introduction="@Localizer["PopoverConfirmsTriggerIntro"]"
171+
Name="Trigger">
172+
<PopConfirmButton Placement="Placement.Top"
173+
ConfirmIcon="fa-solid fa-triangle-exclamation text-info"
174+
Color="Color.Primary"
175+
ConfirmButtonColor="Color.Info"
176+
Trigger="hover focus" ShowCloseButton="false" ShowConfirmButton="false"
177+
Text="@Localizer["PopoverConfirmsBodyTemplateButtonText"]">
178+
<BodyTemplate>
179+
<div class="d-flex align-items-center">
180+
Label: Just a demo
181+
</div>
182+
</BodyTemplate>
183+
</PopConfirmButton>
184+
</DemoBlock>
185+
169186
<AttributeTable Items="@GetAttributes()" />
170187

171188
<EventTable Items="@GetEvents()" />

src/BootstrapBlazor.Server/Components/Samples/PopoverConfirms.razor.cs

+24
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,30 @@ private static AttributeItem[] GetAttributes() =>
166166
Type = "string",
167167
ValueList = "",
168168
DefaultValue = " "
169+
},
170+
new()
171+
{
172+
Name = nameof(PopConfirmButton.Trigger),
173+
Description = "How pop confirm is triggered",
174+
Type = "string",
175+
ValueList = "click|hover|focus",
176+
DefaultValue = "click"
177+
},
178+
new()
179+
{
180+
Name = nameof(PopConfirmButton.ShowCloseButton),
181+
Description = "Whether to display the close button",
182+
Type = "string",
183+
ValueList = "true/false",
184+
DefaultValue = "true"
185+
},
186+
new()
187+
{
188+
Name = nameof(PopConfirmButton.ShowConfirmButton),
189+
Description = "Whether to display the confirm button",
190+
Type = "string",
191+
ValueList = "true/false",
192+
DefaultValue = "true"
169193
}
170194
];
171195

src/BootstrapBlazor.Server/Locales/en-US.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@
320320
"PopoverConfirmsShowButtonsTitle": "Custom Component",
321321
"PopoverConfirmsShowButtonsIntro": "By setting <code>ShowCloseButton=\"false\"</code> <code>ShowConfirmButton=\"false\"</code>, you don't display the built-in function buttons, and customize an <b>Approve</b> button in the custom component.",
322322
"PopoverConfirmsShowButtonsButtonText": "Custom Component",
323-
"PopoverConfirmsShowButtonsDesc": "In a custom component, you can call the <code>Close</code> or <code>Confirm</code> method inside the component through cascading parameters"
323+
"PopoverConfirmsShowButtonsDesc": "In a custom component, you can call the <code>Close</code> or <code>Confirm</code> method inside the component through cascading parameters",
324+
"PopoverConfirmsTriggerTitle": "Trigger",
325+
"PopoverConfirmsTriggerIntro": "By setting the <code>Trigger</code> parameter, you can set the way the component pops up the confirmation box. The default value is <code>click</code>. You can also set <code>hover focus</code> to use in combination."
324326
},
325327
"BootstrapBlazor.Server.Components.Components.CustomPopConfirmContent": {
326328
"CustomPopConfirmContentText": "Custom content",

src/BootstrapBlazor.Server/Locales/zh-CN.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@
320320
"PopoverConfirmsShowButtonsTitle": "自定义组件",
321321
"PopoverConfirmsShowButtonsIntro": "通过设置 <code>ShowCloseButton=\"false\"</code> <code>ShowConfirmButton=\"false\"</code> 不显示内置功能按钮,在自定义组件中自定义一个 <b>审批</b> 按钮",
322322
"PopoverConfirmsShowButtonsButtonText": "自定义组件",
323-
"PopoverConfirmsShowButtonsDesc": "自定义组件内可通过级联参数调用组件内部的 <code>Close</code> 或者 <code>Confirm</code> 方法"
323+
"PopoverConfirmsShowButtonsDesc": "自定义组件内可通过级联参数调用组件内部的 <code>Close</code> 或者 <code>Confirm</code> 方法",
324+
"PopoverConfirmsTriggerTitle": "触发方式",
325+
"PopoverConfirmsTriggerIntro": "通过设置 <code>Trigger</code> 参数来设置组件弹出确认框的方式,默认值为 <code>click</code> 还可以设置 <code>hover focus</code> 可组合使用"
324326
},
325327
"BootstrapBlazor.Server.Components.Components.CustomPopConfirmContent": {
326328
"CustomPopConfirmContentText": "自定义弹窗内容",

src/BootstrapBlazor/Components/Button/PopConfirmButtonBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public abstract class PopConfirmButtonBase : ButtonBase
3535
public Placement Placement { get; set; }
3636

3737
/// <summary>
38-
/// 获得/设置 弹窗触发方式 默认 click
38+
/// 获得/设置 弹窗触发方式 默认 click 可设置 hover focus
3939
/// </summary>
4040
[Parameter]
4141
public string? Trigger { get; set; }

0 commit comments

Comments
 (0)