mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-12-10 16:43:47 +08:00
!2286 feat(#I4PBOF): add AdvanceSearchs on QueryOptions for Table component
* test: 移除不需要的单元测试 * feat: bump version to beta13 * feat: Table 组件增加 AdvanceSearchs 条件集合
This commit is contained in:
parent
df09bf8389
commit
e59096592a
@ -1,7 +1,7 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Version>6.1.2-beta12</Version>
|
<Version>6.1.2-beta13</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
|
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
|
||||||
|
@ -333,6 +333,7 @@ public partial class Table<TItem>
|
|||||||
SortList = SortList,
|
SortList = SortList,
|
||||||
Filters = Filters.Values,
|
Filters = Filters.Values,
|
||||||
Searchs = GetSearchs(),
|
Searchs = GetSearchs(),
|
||||||
|
AdvanceSearchs = GetAdvanceSearchs(),
|
||||||
CustomerSearchs = GetCustomerSearchs(),
|
CustomerSearchs = GetCustomerSearchs(),
|
||||||
SearchModel = SearchModel,
|
SearchModel = SearchModel,
|
||||||
StartIndex = StartIndex
|
StartIndex = StartIndex
|
||||||
|
@ -219,6 +219,30 @@ public partial class Table<TItem>
|
|||||||
return searchs;
|
return searchs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获得 <see cref="SearchModel"/> 中过滤条件
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
protected IEnumerable<IFilterAction> GetAdvanceSearchs()
|
||||||
|
{
|
||||||
|
var searchs = new List<IFilterAction>();
|
||||||
|
// 处理 SearchModel 条件
|
||||||
|
if (SearchModel != null)
|
||||||
|
{
|
||||||
|
// 处理 SearchModel
|
||||||
|
var searchColumns = Columns.Where(i => i.Searchable);
|
||||||
|
foreach (var property in SearchModel.GetType().GetProperties().Where(i => searchColumns.Any(col => col.GetFieldName() == i.Name)))
|
||||||
|
{
|
||||||
|
var v = property.GetValue(SearchModel);
|
||||||
|
if (v != null)
|
||||||
|
{
|
||||||
|
searchs.Add(new SearchFilterAction(property.Name, v, FilterAction.Equal));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return searchs;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 通过列集合中的 <see cref="ITableColumn.Searchable"/> 列与 <see cref="SearchText"/> 拼装 IFilterAction 集合
|
/// 通过列集合中的 <see cref="ITableColumn.Searchable"/> 列与 <see cref="SearchText"/> 拼装 IFilterAction 集合
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -28,10 +28,15 @@ public class QueryPageOptions
|
|||||||
public IEnumerable<IFilterAction> Searchs { get; set; } = Enumerable.Empty<IFilterAction>();
|
public IEnumerable<IFilterAction> Searchs { get; set; } = Enumerable.Empty<IFilterAction>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得/设置 获得 <see cref="Table{TItem}.CustomerSearchModel"/> 中过滤条件 <see cref="Table{TItem}.SearchTemplate"/> 模板中的条件无法获得
|
/// 获得/设置 获得 <see cref="Table{TItem}.CustomerSearchModel"/> 中过滤条件 <see cref="Table{TItem}.SearchTemplate"/> 模板中的条件请使用 <see cref="AdvanceSearchs" />获得
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IEnumerable<IFilterAction> CustomerSearchs { get; set; } = Enumerable.Empty<IFilterAction>();
|
public IEnumerable<IFilterAction> CustomerSearchs { get; set; } = Enumerable.Empty<IFilterAction>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获得/设置 获得 <see cref="Table{TItem}.SearchModel"/> 中过滤条件
|
||||||
|
/// </summary>
|
||||||
|
public IEnumerable<IFilterAction> AdvanceSearchs { get; set; } = Enumerable.Empty<IFilterAction>();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获得/设置 排序字段名称
|
/// 获得/设置 排序字段名称
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -35,30 +35,6 @@ public class EmptyTest : BootstrapBlazorTestBase
|
|||||||
Assert.Contains(text, cut.Markup);
|
Assert.Contains(text, cut.Markup);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Width_Ok()
|
|
||||||
{
|
|
||||||
var cut = Context.RenderComponent<Empty>(builder =>
|
|
||||||
{
|
|
||||||
builder.Add(p => p.Width, "200");
|
|
||||||
builder.Add(i => i.Image, "/src/image/argo.png");
|
|
||||||
});
|
|
||||||
|
|
||||||
Assert.Contains("width=\"200\"", cut.Markup);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
|
||||||
public void Height_Ok()
|
|
||||||
{
|
|
||||||
var cut = Context.RenderComponent<Empty>(builder =>
|
|
||||||
{
|
|
||||||
builder.Add(p => p.Height, "200");
|
|
||||||
builder.Add(i => i.Image, "/src/image/argo.png");
|
|
||||||
});
|
|
||||||
|
|
||||||
Assert.Contains("height=\"200\"", cut.Markup);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public void ChildContent_Ok()
|
public void ChildContent_Ok()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user