feat: Table 组件支持设置编辑窗口 Title 功能

This commit is contained in:
Argo-SHCX 2020-04-14 12:44:55 +08:00
parent 0996931931
commit a39087c7c4
4 changed files with 17 additions and 6 deletions

View File

@ -146,7 +146,7 @@
<Table TItem="BootstrapBlazor.WebConsole.Pages.BindItem"
IsPagination="true" PageItemsSource="@PageItemsSource"
IsStriped="true" IsBordered="true" ShowToolbar="true" ShowSearch="true" ShowCheckbox="true"
EditModalTitle="测试数据编辑窗口"
AddModalTitle="增加测试数据窗口" EditModalTitle="编辑测试数据窗口"
SearchModel="@SearchModel"
OnQuery="@OnQuery" OnResetSearch="@OnResetSearch"
OnAdd="@OnAdd" OnSave="@OnSave" OnDelete="@OnDelete">

View File

@ -104,7 +104,7 @@
@if (OnSave != null || OnAdd != null)
{
<Modal @ref="EditModal" Title="@EditModalTitle" Size="@Size.ExtraLarge" IsCentered="true">
<Modal @ref="EditModal" Title="@EditModalTitleString" Size="@Size.ExtraLarge" IsCentered="true">
<ModalBody>
<ValidateForm @ref="@ValidateForm" Model="@EditModel" OnValidSubmit="@Save">
@EditTemplate?.Invoke(EditModel)

View File

@ -10,6 +10,11 @@ namespace BootstrapBlazor.Components
/// </summary>
protected PopoverConfirm? DeleteConfirm { get; set; }
/// <summary>
/// 获得/设置 编辑弹窗 Title 文字
/// </summary>
protected string? EditModalTitleString { get; set; }
/// <summary>
/// 获得/设置 被选中数据集合
/// </summary>
@ -22,14 +27,19 @@ namespace BootstrapBlazor.Components
protected ValidateForm? ValidateForm { get; set; }
/// <summary>
/// 编辑数据弹窗
/// 获得/设置 编辑数据弹窗实例
/// </summary>
protected Modal? EditModal { get; set; }
/// <summary>
/// 编辑数据弹窗 Title
/// 获得/设置 编辑数据弹窗 Title
/// </summary>
[Parameter] public string? EditModalTitle { get; set; }
[Parameter] public string EditModalTitle { get; set; } = "编辑数据窗口";
/// <summary>
/// 获得/设置 新建数据弹窗 Title
/// </summary>
[Parameter] public string AddModalTitle { get; set; } = "新建数据窗口";
/// <summary>
/// 获得/设置 EditTemplate 实例

View File

@ -79,7 +79,7 @@ namespace BootstrapBlazor.Components
{
if (OnAdd != null) EditModel = OnAdd.Invoke() ?? new TItem();
SelectedItems.Clear();
EditModalTitle = "新建数据窗口";
EditModalTitleString = AddModalTitle;
EditModal?.Toggle();
}
@ -91,6 +91,7 @@ namespace BootstrapBlazor.Components
if (SelectedItems.Count == 1)
{
EditModel = SelectedItems[0].Clone();
EditModalTitleString = EditModalTitle;
EditModal?.Toggle();
}
else