refactor: 更改 Table 组件属性默认值
This commit is contained in:
parent
09e72eb0ee
commit
e8b824c6a0
|
@ -90,12 +90,6 @@ namespace Bootstrap.Admin.Components
|
|||
[Parameter]
|
||||
public bool FixedHeader { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 是否显示搜索框 默认为 false 不显示搜索框
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool ShowSearch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 Table 实例
|
||||
/// </summary>
|
||||
|
|
|
@ -105,19 +105,43 @@ namespace Bootstrap.Admin.Components
|
|||
/// 获得/设置 是否显示行号
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool ShowLineNo { get; set; } = true;
|
||||
public bool ShowLineNo { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 是否显示选择列 默认为 true
|
||||
/// 获得/设置 是否显示选择列 默认为 false
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool ShowCheckbox { get; set; } = true;
|
||||
public bool ShowCheckbox { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 是否显示按钮列 默认为 true
|
||||
/// 获得/设置 是否显示按钮列 默认为 false
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool ShowButtons { get; set; } = true;
|
||||
public bool ShowDefaultButtons { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 是否显示表脚 默认为 false
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool ShowFooter { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 是否显示扩展按钮 默认为 true
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool ShowExtendButtons { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 是否显示刷新按钮 默认为 true
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool ShowRefresh { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 是否分页组件 默认为 false
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool ShowPagination { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 是否显示工具栏 默认为 true
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@inherits DictsBase
|
||||
|
||||
<EditPage Id="dict" FixedHeader="@FixedHeader" ShowSearch="true" TItem="Bootstrap.Security.BootstrapDict" SubmitModalTitle="字典编辑窗口" QueryModel="QueryModel" OnQuery="Query" OnAdd="Add" OnDelete="Delete" OnSave="Save" OnResetSearch="ResetSearch">
|
||||
<EditPage Id="dict" FixedHeader="@FixedHeader" TItem="Bootstrap.Security.BootstrapDict" SubmitModalTitle="字典编辑窗口" QueryModel="QueryModel" OnQuery="Query" OnAdd="Add" OnDelete="Delete" OnSave="Save" OnResetSearch="ResetSearch">
|
||||
<QueryBody>
|
||||
<LgbInputText ColumnClass="col-12" @bind-Value="@context.Category" maxlength="50" />
|
||||
<Select ColumnClass="col-12" Items="QueryDefine" TItem="int" @bind-Value="@context.Define" />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@inherits GroupsBase
|
||||
|
||||
<EditPage Id="group" FixedHeader="@FixedHeader" ShowSearch="true" TItem="Bootstrap.DataAccess.Group" SubmitModalTitle="部门编辑窗口" QueryModel="QueryModel" OnQuery="Query" OnAdd="Add" OnDelete="Delete" OnSave="Save" OnResetSearch="ResetSearch">
|
||||
<EditPage Id="group" FixedHeader="@FixedHeader" TItem="Bootstrap.DataAccess.Group" SubmitModalTitle="部门编辑窗口" QueryModel="QueryModel" OnQuery="Query" OnAdd="Add" OnDelete="Delete" OnSave="Save" OnResetSearch="ResetSearch">
|
||||
<QueryBody>
|
||||
<LgbInputText ColumnClass="col-sm-auto" @bind-Value="@context.GroupName" maxlength="50" />
|
||||
<LgbInputText ColumnClass="col-sm-auto" @bind-Value="@context.Description" maxlength="50" />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@inherits MenusBase
|
||||
|
||||
<EditPage Id="menu" FixedHeader="@FixedHeader" ShowSearch="true" TItem="Bootstrap.Security.BootstrapMenu" SubmitModalTitle="菜单编辑窗口" QueryModel="QueryModel" OnQuery="Query" OnAdd="Add" OnDelete="Delete" OnSave="Save" OnResetSearch="ResetSearch">
|
||||
<EditPage Id="menu" FixedHeader="@FixedHeader" TItem="Bootstrap.Security.BootstrapMenu" SubmitModalTitle="菜单编辑窗口" QueryModel="QueryModel" OnQuery="Query" OnAdd="Add" OnDelete="Delete" OnSave="Save" OnResetSearch="ResetSearch">
|
||||
<QueryBody>
|
||||
<LgbInputText ColumnClass="col-sm-auto" @bind-Value="@context.Name" maxlength="50" />
|
||||
<LgbInputText ColumnClass="col-sm-auto" @bind-Value="@context.ParentName" maxlength="50" />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@inherits RolesBase
|
||||
|
||||
<EditPage Id="role" FixedHeader="@FixedHeader" ShowSearch="true" TItem="Bootstrap.DataAccess.Role" SubmitModalTitle="角色编辑窗口" QueryModel="QueryModel" OnQuery="Query" OnAdd="Add" OnDelete="Delete" OnSave="Save" OnResetSearch="ResetSearch">
|
||||
<EditPage Id="role" FixedHeader="@FixedHeader" TItem="Bootstrap.DataAccess.Role" SubmitModalTitle="角色编辑窗口" QueryModel="QueryModel" OnQuery="Query" OnAdd="Add" OnDelete="Delete" OnSave="Save" OnResetSearch="ResetSearch">
|
||||
<QueryBody>
|
||||
<LgbInputText ColumnClass="col-sm-auto" @bind-Value="@context.RoleName" maxlength="50" />
|
||||
<LgbInputText ColumnClass="col-sm-auto" @bind-Value="@context.Description" maxlength="50" />
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
@inherits UsersBase
|
||||
|
||||
<EditPage Id="user" FixedHeader="@FixedHeader" ShowSearch="true" TItem="Bootstrap.DataAccess.User" SubmitModalTitle="用户编辑窗口" QueryModel="QueryModel" OnQuery="Query" OnAdd="Add" OnDelete="Delete" OnSave="Save" OnResetSearch="ResetSearch">
|
||||
<EditPage Id="user" FixedHeader="@FixedHeader" TItem="Bootstrap.DataAccess.User" SubmitModalTitle="用户编辑窗口" QueryModel="QueryModel" OnQuery="Query" OnAdd="Add" OnDelete="Delete" OnSave="Save" OnResetSearch="ResetSearch">
|
||||
<QueryBody>
|
||||
<LgbInputText ColumnClass="col-sm-auto" @bind-Value="@context.UserName" maxlength="50" />
|
||||
<LgbInputText ColumnClass="col-sm-auto" @bind-Value="@context.DisplayName" maxlength="50" />
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
查询结果
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<Table @ref="Table" Id="@Id" FixedHeader="@FixedHeader" ShowSearch="@ShowSearch" QueryModel="QueryModel" TItem="TItem" SubmitModalTitle="@SubmitModalTitle" OnQuery="QueryData" OnAdd="OnAdd" OnDelete="OnDelete" OnSave="OnSave" OnResetSearch="OnResetSearch">
|
||||
<Table @ref="Table" Id="@Id" FixedHeader="@FixedHeader" ShowSearch="true" ShowLineNo="true" ShowCheckbox="true" ShowDefaultButtons="true" ShowPagination="true" QueryModel="QueryModel" TItem="TItem" SubmitModalTitle="@SubmitModalTitle" OnQuery="QueryData" OnAdd="OnAdd" OnDelete="OnDelete" OnSave="OnSave" OnResetSearch="OnResetSearch">
|
||||
<TableToolbarTemplate>
|
||||
@TableToolbarTemplate
|
||||
</TableToolbarTemplate>
|
||||
|
|
|
@ -3,36 +3,51 @@
|
|||
|
||||
<div class="bootstrap-table">
|
||||
<div class="fixed-table-toolbar">
|
||||
<div class="float-left @(ShowToolBar ? "bs-bars" : "bs-bars d-none")">
|
||||
<TableToolbar>
|
||||
<TableToolbarContent />
|
||||
<TableToolbarButton class="btn btn-success" Icon="fa fa-plus" Title="新增" OnClick="Add" />
|
||||
<TableToolbarButton class="btn btn-danger" Icon="fa fa-remove" Title="删除" OnClick="Delete" />
|
||||
<TableToolbarButton class="btn btn-primary" Icon="fa fa-pencil" Title="编辑" OnClick="Edit" />
|
||||
@TableToolbarTemplate
|
||||
</TableToolbar>
|
||||
<div class="float-left bs-bars">
|
||||
@if(ShowToolBar)
|
||||
{
|
||||
<TableToolbar>
|
||||
<TableToolbarContent />
|
||||
@if(ShowDefaultButtons)
|
||||
{
|
||||
<TableToolbarButton class="btn btn-success" Icon="fa fa-plus" Title="新增" OnClick="Add" />
|
||||
<TableToolbarButton class="btn btn-danger" Icon="fa fa-remove" Title="删除" OnClick="Delete" />
|
||||
<TableToolbarButton class="btn btn-primary" Icon="fa fa-pencil" Title="编辑" OnClick="Edit" />
|
||||
}
|
||||
@TableToolbarTemplate
|
||||
</TableToolbar>
|
||||
}
|
||||
</div>
|
||||
<div class="float-right columns columns-right">
|
||||
<button class="btn btn-secondary" type="button" title="刷新" @onclick="Query">
|
||||
<i class="fa fa-refresh"></i><span>刷新</span>
|
||||
</button>
|
||||
@if(ShowToolBar)
|
||||
{
|
||||
@if(ShowRefresh)
|
||||
{
|
||||
<button class="btn btn-secondary" type="button" title="刷新" @onclick="Query">
|
||||
<i class="fa fa-refresh"></i><span>刷新</span>
|
||||
</button>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
<div class="float-right @(ShowSearch ? "search btn-group" : "search btn-group d-none")">
|
||||
<div class="input-group">
|
||||
<input class="form-control search-input" type="text" placeholder="搜索" @bind="SearchText" />
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary" type="button" title="搜索" @onclick="SearchClick">
|
||||
<i class="fa fa-search"></i><span>搜索</span>
|
||||
</button>
|
||||
<button class="btn btn-secondary" type="button" title="清空过滤" @onclick="ClearSearchClick">
|
||||
<i class="fa fa-trash"></i> <span>清空过滤</span>
|
||||
</button>
|
||||
<button class="btn btn-secondary" type="button" title="高级搜索" @onclick="AdvancedSearchClick">
|
||||
<i class="fa fa-search-plus"></i><span>高级搜索</span>
|
||||
</button>
|
||||
@if(ShowSearch)
|
||||
{
|
||||
<div class="float-right search btn-group">
|
||||
<div class="input-group">
|
||||
<input class="form-control search-input" type="text" placeholder="搜索" @bind="SearchText" />
|
||||
<div class="input-group-append">
|
||||
<button class="btn btn-secondary" type="button" title="搜索" @onclick="SearchClick">
|
||||
<i class="fa fa-search"></i><span>搜索</span>
|
||||
</button>
|
||||
<button class="btn btn-secondary" type="button" title="清空过滤" @onclick="ClearSearchClick">
|
||||
<i class="fa fa-trash"></i> <span>清空过滤</span>
|
||||
</button>
|
||||
<button class="btn btn-secondary" type="button" title="高级搜索" @onclick="AdvancedSearchClick">
|
||||
<i class="fa fa-search-plus"></i><span>高级搜索</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
<div class="@(FixedHeader ? "table-wrapper table-fixed-header table-fixed" : "table-wrapper")">
|
||||
|
@ -51,7 +66,7 @@
|
|||
<th class="table-col-lineno">行号</th>
|
||||
}
|
||||
@TableHeader?.Invoke(EditModel)
|
||||
@if (ShowButtons)
|
||||
@if (ShowExtendButtons)
|
||||
{
|
||||
<th>@ButtonTemplateHeaderText</th>
|
||||
}
|
||||
|
@ -72,7 +87,7 @@
|
|||
<th class="table-col-lineno">行号</th>
|
||||
}
|
||||
@TableHeader?.Invoke(EditModel)
|
||||
@if (ShowButtons)
|
||||
@if (ShowExtendButtons)
|
||||
{
|
||||
<th>@ButtonTemplateHeaderText</th>
|
||||
}
|
||||
|
@ -91,7 +106,7 @@
|
|||
<td class="table-col-lineno">@(index + 1 + (PageIndex - 1) * PageItems)</td>
|
||||
}
|
||||
@RowTemplate?.Invoke(Items.ElementAt(index))
|
||||
@if (ShowButtons)
|
||||
@if (ShowExtendButtons)
|
||||
{
|
||||
<td>@ButtonTemplate?.Invoke(Items.ElementAt(index))</td>
|
||||
}
|
||||
|
@ -118,7 +133,7 @@
|
|||
<th class="table-col-lineno">行号</th>
|
||||
}
|
||||
@TableHeader?.Invoke(EditModel)
|
||||
@if (ShowButtons)
|
||||
@if (ShowExtendButtons)
|
||||
{
|
||||
<th>@ButtonTemplateHeaderText</th>
|
||||
}
|
||||
|
@ -137,62 +152,77 @@
|
|||
<td class="table-col-lineno">@(index + 1 + (PageIndex - 1) * PageItems)</td>
|
||||
}
|
||||
@RowTemplate?.Invoke(Items.ElementAt(index))
|
||||
@if (ShowButtons)
|
||||
@if (ShowExtendButtons)
|
||||
{
|
||||
<td>@ButtonTemplate?.Invoke(Items.ElementAt(index))</td>
|
||||
}
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>@TableFooter</tr>
|
||||
</tfoot>
|
||||
@if(ShowFooter)
|
||||
{
|
||||
<tfoot>
|
||||
<tr>@TableFooter</tr>
|
||||
</tfoot>
|
||||
}
|
||||
</table>
|
||||
}
|
||||
</div>
|
||||
<Pagination PageItems="PageItems" TotalCount="TotalCount" PageIndex="PageIndex" OnPageClick="PageClick" OnPageItemsChange="PageItemsChange"></Pagination>
|
||||
@if(ShowPagination)
|
||||
{
|
||||
<Pagination PageItems="PageItems" TotalCount="TotalCount" PageIndex="PageIndex" OnPageClick="PageClick" OnPageItemsChange="PageItemsChange"></Pagination>
|
||||
}
|
||||
</div>
|
||||
|
||||
<Modal @ref="ConfirmModal" Id="@($"{Id}_confirm")" Title="数据删除">
|
||||
<ModalBody>
|
||||
<div class="modal-confirm-body">您确定要删除选中的所有数据吗?</div>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<button type="button" class="btn btn-danger" @onclick="Confirm">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
<span>我要删除</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">
|
||||
<i class="fa fa-times"></i>
|
||||
<span>取消</span>
|
||||
</button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
@if(OnDelete != null)
|
||||
{
|
||||
<Modal @ref="ConfirmModal" Id="@($"{Id}_confirm")" Title="数据删除">
|
||||
<ModalBody>
|
||||
<div class="modal-confirm-body">您确定要删除选中的所有数据吗?</div>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<button type="button" class="btn btn-danger" @onclick="Confirm">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
<span>我要删除</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">
|
||||
<i class="fa fa-times"></i>
|
||||
<span>取消</span>
|
||||
</button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
}
|
||||
|
||||
<SubmitModal @ref="EditModal" Id="@($"{Id}_edit")" TItem="TItem" Title="@SubmitModalTitle" Size="ModalSize.ExtraLarge" @bind-Model="EditModel" OnValidSubmit="Save">
|
||||
<ModalBody>
|
||||
@EditTemplate?.Invoke(EditModel)
|
||||
</ModalBody>
|
||||
</SubmitModal>
|
||||
@if(OnSave != null)
|
||||
{
|
||||
<SubmitModal @ref="EditModal" Id="@($"{Id}_edit")" TItem="TItem" Title="@SubmitModalTitle" Size="ModalSize.ExtraLarge" @bind-Model="EditModel" OnValidSubmit="Save">
|
||||
<ModalBody>
|
||||
@EditTemplate?.Invoke(EditModel)
|
||||
</ModalBody>
|
||||
</SubmitModal>
|
||||
}
|
||||
|
||||
<Modal @ref="SearchModal" Id="@($"{Id}_search")" Title="查询条件">
|
||||
<ModalBody>
|
||||
<LgbEditForm class="form-inline" Id="@Id" Model="QueryModel">
|
||||
<div class="row">
|
||||
@SearchTemplate?.Invoke(QueryModel)
|
||||
</div>
|
||||
</LgbEditForm>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<button type="button" class="btn btn-info" data-dismiss="modal" @onclick="ResetSearchClick">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
<span>重置</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal" @onclick="SearchClick">
|
||||
<i class="fa fa-search"></i>
|
||||
<span>查询</span>
|
||||
</button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
@if(ShowSearch)
|
||||
{
|
||||
<Modal @ref="SearchModal" Id="@($"{Id}_search")" Title="查询条件">
|
||||
<ModalBody>
|
||||
<LgbEditForm class="form-inline" Id="@Id" Model="QueryModel">
|
||||
<div class="row">
|
||||
@SearchTemplate?.Invoke(QueryModel)
|
||||
</div>
|
||||
</LgbEditForm>
|
||||
</ModalBody>
|
||||
<ModalFooter>
|
||||
<button type="button" class="btn btn-info" data-dismiss="modal" @onclick="ResetSearchClick">
|
||||
<i class="fa fa-trash-o"></i>
|
||||
<span>重置</span>
|
||||
</button>
|
||||
<button type="button" class="btn btn-primary" data-dismiss="modal" @onclick="SearchClick">
|
||||
<i class="fa fa-search"></i>
|
||||
<span>查询</span>
|
||||
</button>
|
||||
</ModalFooter>
|
||||
</Modal>
|
||||
}
|
||||
|
||||
<Toast @ref="Toast" Id="@($"{Id}_toast")"></Toast>
|
||||
|
|
Loading…
Reference in New Issue