mirror of
https://gitee.com/LongbowEnterprise/BootstrapBlazor.git
synced 2024-12-04 21:20:16 +08:00
!2410 feat(#I4T5JG): add AutoClearSearchText parameter on Select
* chore: bump version 6.3.1-beta03 * test: 增加 AutoClearSearchText 单元测试 * doc: 增加 自动清空搜索文本 示例 * feat: 增加 AutoClearSearchText 属性
This commit is contained in:
parent
502f12e618
commit
b285bc34f7
@ -1491,12 +1491,13 @@
|
||||
"BlockShowSearchTitle": "Drop-down box with search box",
|
||||
"BlockShowSearchIntro": "Controls whether the search box is displayed by setting the <code>ShowSearch</code> property, which is not displayed by default false",
|
||||
"Block15Title": "Drop-down box with confirmation",
|
||||
"Block15Intro": "Block changes to the current value by setting the <code> onBeforeSelectedItemChange </code> delegate.",
|
||||
"Block15Intro": "Block changes to the current value by setting the <code>OnBeforeSelectedItemChange</code> delegate.",
|
||||
"SwalTitle": "The drop-down box value changes",
|
||||
"SwalContent": "Are you sure you want to change the option value?",
|
||||
"SwalFooter": "Click Confirm to change the option value and select Cancel to leave the value unchanged",
|
||||
"ShowLabel": "Whether to display the front label",
|
||||
"ShowSearch": "Whether to display the search box",
|
||||
"AutoClearSearchTextIntro": "By default, the component will maintain the searchtext content. You can set the <code>AutoClearSearchText</code> parameter to control the automatic emptying of the search content when click the select item",
|
||||
"DisplayText": "The front label displays text",
|
||||
"Class": "Style",
|
||||
"Color": "Color",
|
||||
|
@ -1500,6 +1500,7 @@
|
||||
"SwalFooter": "点击确认改变选项值,选择取消后值不变",
|
||||
"ShowLabel": "是否显示前置标签",
|
||||
"ShowSearch": "是否显示搜索框",
|
||||
"AutoClearSearchTextIntro": "默认情况下组件会保持 SearchText 内容,可以通过设置 <code>AutoClearSearchText</code> 参数来控制选中候选项时自动清空搜索内容",
|
||||
"DisplayText": "前置标签显示文本",
|
||||
"Class": "样式",
|
||||
"Color": "颜色",
|
||||
|
@ -113,7 +113,7 @@
|
||||
</ValidateForm>
|
||||
</DemoBlock>
|
||||
|
||||
<DemoBlock Title="@Localizer["Block6Title"]" Introduction="@Localizer["Block6Intro"]" Name="Group">
|
||||
<DemoBlock Title="@Localizer["Block6Title"]" Introduction="@Localizer["Block6Intro"]" Name="Group">
|
||||
<div class="row g-3">
|
||||
<div class="col-12 col-sm-6">
|
||||
<Select TValue="string" Color="Color.Primary" Items="GroupItems">
|
||||
@ -133,7 +133,7 @@
|
||||
</div>
|
||||
</DemoBlock>
|
||||
|
||||
<DemoBlock Title="@Localizer["Block8Title"]" Introduction="@Localizer["Block8Intro"]" Name="DispalyLabel">
|
||||
<DemoBlock Title="@Localizer["Block8Title"]" Introduction="@Localizer["Block8Intro"]" Name="DispalyLabel">
|
||||
<p>@((MarkupString)Localizer["P3"].Value)</p>
|
||||
<Divider Text="@Localizer["Divider1"]" Alignment="Alignment.Left" style="margin: 2rem 0;"></Divider>
|
||||
<ValidateForm Model="Model">
|
||||
@ -171,7 +171,7 @@
|
||||
</div>
|
||||
</DemoBlock>
|
||||
|
||||
<DemoBlock Title="@Localizer["Block10Title"]" Introduction="@Localizer["Block10Intro"]" Name="Enum">
|
||||
<DemoBlock Title="@Localizer["Block10Title"]" Introduction="@Localizer["Block10Intro"]" Name="Enum">
|
||||
<p>@((MarkupString)Localizer["P4"].Value)</p>
|
||||
<p>@((MarkupString)Localizer["P5"].Value)</p>
|
||||
<div class="row g-3">
|
||||
@ -236,18 +236,19 @@
|
||||
</div>
|
||||
</DemoBlock>
|
||||
|
||||
<DemoBlock Title="@Localizer["BlockShowSearchTitle"]" Introduction="@Localizer["BlockShowSearchIntro"]" Name="ShowSearch">
|
||||
<DemoBlock Title="@Localizer["BlockShowSearchTitle"]" Introduction="@Localizer["BlockShowSearchIntro"]" Name="ShowSearch">
|
||||
<p>@((MarkupString)Localizer["AutoClearSearchTextIntro"].Value)</p>
|
||||
<div class="row g-3">
|
||||
<div class="col-12 col-sm-6">
|
||||
<Select TValue="string" Items="Items" ShowSearch="true" />
|
||||
</div>
|
||||
<div class="col-12 col-sm-6">
|
||||
<Select TValue="string" Items="StringItems" ShowSearch="true" />
|
||||
<Select TValue="string" Items="StringItems" ShowSearch="true" AutoClearSearchText="true" />
|
||||
</div>
|
||||
</div>
|
||||
</DemoBlock>
|
||||
|
||||
<DemoBlock Title="@Localizer["Block15Title"]" Introduction="@Localizer["Block15Intro"]" Name="ConfirmSelect">
|
||||
<DemoBlock Title="@Localizer["Block15Title"]" Introduction="@Localizer["Block15Intro"]" Name="ConfirmSelect">
|
||||
<div class="row g-3">
|
||||
<div class="col-12 col-sm-6">
|
||||
<Select TValue="string" Items="Items" OnBeforeSelectedItemChange="@OnBeforeSelectedItemChange"
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Razor">
|
||||
|
||||
<PropertyGroup>
|
||||
<Version>6.3.1-beta02</Version>
|
||||
<Version>6.3.1-beta03</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="'$(TargetFramework)' == 'net5.0'">
|
||||
|
@ -81,6 +81,12 @@ public partial class Select<TValue> : ISelect
|
||||
[Parameter]
|
||||
public bool ShowSearch { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得/设置 选中候选项后是否自动清空搜索框内容 默认 false 不清空
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool AutoClearSearchText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 获得 PlaceHolder 属性
|
||||
/// </summary>
|
||||
@ -261,6 +267,11 @@ public partial class Select<TValue> : ISelect
|
||||
{
|
||||
await OnSelectedItemChanged.Invoke(SelectedItem);
|
||||
}
|
||||
|
||||
if (AutoClearSearchText)
|
||||
{
|
||||
SearchText = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -17,6 +17,7 @@ public class SelectTest : BootstrapBlazorTestBase
|
||||
pb.AddChildContent<Select<string>>(pb =>
|
||||
{
|
||||
pb.Add(a => a.ShowSearch, true);
|
||||
pb.Add(a => a.AutoClearSearchText, true);
|
||||
pb.Add(a => a.Items, new List<SelectedItem>()
|
||||
{
|
||||
new SelectedItem("1", "Test1"),
|
||||
|
Loading…
Reference in New Issue
Block a user