Skip to content

Commit da541e3

Browse files
committed
!3748 feat(#I6A0DS): add cascading parameter for Modal footer
* chore: bump version 7.2.3-beta03 * refactor: 移除冗余的级联参数 * feat: Footer 增加级联参数 OnCloseAsync * feat: 增加 CloseButtonIcon
1 parent 89acf51 commit da541e3

3 files changed

Lines changed: 31 additions & 24 deletions

File tree

src/BootstrapBlazor/BootstrapBlazor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>7.2.3-beta02</Version>
4+
<Version>7.2.3-beta03</Version>
55
</PropertyGroup>
66

77
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">

src/BootstrapBlazor/Components/Modal/ModalDialog.razor

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -39,30 +39,28 @@
3939
<div class="modal-body">
4040
@RenderBodyTemplate()
4141
</div>
42-
</CascadingValue>
43-
@if (ShowFooter)
44-
{
45-
<div class="modal-footer">
46-
@if (ShowCloseButton)
47-
{
48-
<Button Color="Color.Secondary" Text="@CloseButtonText" Icon="fa-solid fa-fw fa-xmark" OnClickWithoutRender="OnClickClose" />
49-
}
50-
@if (ShowPrintButton && !ShowPrintButtonInHeader)
51-
{
52-
<PrintButton Color="Color.Primary" class="btn-print" Text="@PrintButtonText" />
53-
}
54-
@if (ShowSaveButton)
55-
{
56-
<Button Color="Color.Primary" Text="@SaveButtonText" Icon="fa-solid fa-fw fa-floppy-disk" OnClickWithoutRender="OnClickSave" />
57-
}
58-
@if (FooterTemplate != null)
59-
{
60-
<CascadingValue Value="OnClickClose" IsFixed>
42+
@if (ShowFooter)
43+
{
44+
<div class="modal-footer">
45+
@if (ShowCloseButton)
46+
{
47+
<DialogCloseButton Text="@CloseButtonText" Icon="@CloseButtonIcon" />
48+
}
49+
@if (ShowPrintButton && !ShowPrintButtonInHeader)
50+
{
51+
<PrintButton Color="Color.Primary" class="btn-print" Text="@PrintButtonText" />
52+
}
53+
@if (ShowSaveButton)
54+
{
55+
<Button Color="Color.Primary" Text="@SaveButtonText" Icon="fa-solid fa-fw fa-floppy-disk" OnClickWithoutRender="OnClickSave" />
56+
}
57+
@if (FooterTemplate != null)
58+
{
6159
@FooterTemplate
62-
</CascadingValue>
63-
}
64-
</div>
65-
}
60+
}
61+
</div>
62+
}
63+
</CascadingValue>
6664
</CascadingValue>
6765
</div>
6866
</div>

src/BootstrapBlazor/Components/Modal/ModalDialog.razor.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,13 @@ public partial class ModalDialog : IHandlerException, IDisposable
183183
[NotNull]
184184
public string? CloseButtonText { get; set; }
185185

186+
/// <summary>
187+
/// 获得/设置 关闭按钮显示图标 未设置时 使用 fa-solid fa-fw fa-xmark
188+
/// </summary>
189+
[Parameter]
190+
[NotNull]
191+
public string? CloseButtonIcon { get; set; }
192+
186193
/// <summary>
187194
/// 获得/设置 保存按钮显示文字 资源文件设置为 保存
188195
/// </summary>
@@ -222,6 +229,8 @@ protected override void OnParametersSet()
222229
CloseButtonText ??= Localizer[nameof(CloseButtonText)];
223230
SaveButtonText ??= Localizer[nameof(SaveButtonText)];
224231
PrintButtonText ??= Localizer[nameof(PrintButtonText)];
232+
233+
CloseButtonIcon ??= "fa-solid fa-fw fa-xmark";
225234
}
226235

227236
/// <summary>

0 commit comments

Comments
 (0)