Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
b16d5f3
chore: bump version 9.2.0-beta01
ArgoZhang Dec 27, 2024
b2e59e7
Merge branch 'test-khyjb1995' into refat-complete
ArgoZhang Dec 27, 2024
1168a7c
chore: bump version 9.1.4
ArgoZhang Dec 28, 2024
3d379d2
refactor: 更新 type 为 text
ArgoZhang Dec 28, 2024
4125b3f
Merge branch 'main' into refat-complete
ArgoZhang Dec 28, 2024
70faa31
Merge branch 'main' into refat-complete
ArgoZhang Dec 28, 2024
e982db0
Merge branch 'main' into refat-complete
ArgoZhang Dec 29, 2024
038cbd5
refactor: 移除拼音处理逻辑
ArgoZhang Dec 29, 2024
9023354
doc: 增加注释文档
ArgoZhang Dec 29, 2024
111a79b
refactor: 更新配置
ArgoZhang Dec 29, 2024
5f24614
refactor: 重新设计下拉菜单显示逻辑
ArgoZhang Dec 29, 2024
68cfa7b
refactor: 增加 Desc 标签
ArgoZhang Dec 29, 2024
877eb3f
Merge branch 'main' into refat-complete
ArgoZhang Dec 29, 2024
bee8b0e
refactor: 重构代码
ArgoZhang Dec 29, 2024
9e7a2e1
refactor: 支持回车按键
ArgoZhang Dec 29, 2024
beef812
refactor: 重构代码
ArgoZhang Dec 29, 2024
e8f8e00
test: 更新单元测试
ArgoZhang Dec 29, 2024
f00ae50
doc: 更新示例
ArgoZhang Dec 29, 2024
cf0ba4e
refactor: 更改修饰符
ArgoZhang Dec 29, 2024
9ddc54f
refactor: 更改样式字符串
ArgoZhang Dec 29, 2024
8fe9940
refactor: 更改变量名称
ArgoZhang Dec 29, 2024
7997535
refactor: 移动参数方法到基类中
ArgoZhang Dec 29, 2024
638bb2e
refactor: 移动部分参数到组件内
ArgoZhang Dec 29, 2024
4e02045
refactor: 移动 TriggerBlure 到基类
ArgoZhang Dec 30, 2024
ead68ff
refactor: 移动 ShowDropdownListOnFocus 到实现类
ArgoZhang Dec 30, 2024
12bc57f
Merge branch 'main' into refat-complete
ArgoZhang Dec 30, 2024
8adb4fa
refactor: 移除 CurrentItemIndex 逻辑
ArgoZhang Dec 30, 2024
06753a0
refactor: 代码重构
ArgoZhang Dec 30, 2024
c6026a1
refactor: 移动点击事件到组件内
ArgoZhang Dec 30, 2024
60e2366
refactor: 移除无用代码
ArgoZhang Dec 30, 2024
5fbdea0
refactor: 精简代码
ArgoZhang Dec 30, 2024
56b386d
feat: 增加获得滚动行为参数逻辑
ArgoZhang Dec 30, 2024
7b0c56c
refactor: 完善 blur 逻辑
ArgoZhang Dec 30, 2024
f364ded
refactor: 增加菜单点击事件销毁逻辑
ArgoZhang Dec 30, 2024
138f1bf
refactor: 增加上下箭头出发下拉菜单逻辑
ArgoZhang Dec 30, 2024
83bfcb1
refactor: 精简样式
ArgoZhang Dec 30, 2024
e1d49b5
doc: 增加 IsPopover 示例
ArgoZhang Dec 30, 2024
6f2cc49
refactor: 增加全局钩子
ArgoZhang Dec 30, 2024
c0d6d0b
doc: 格式化文档
ArgoZhang Dec 30, 2024
396d8ae
refactor: 移动 FilterItems 变量
ArgoZhang Dec 30, 2024
145900c
refactor: 增加 Esc 逻辑
ArgoZhang Dec 30, 2024
8ddeb1d
refactor: 根据 AutoComplete 重构 AutoFill 组件
ArgoZhang Dec 30, 2024
847bb6d
refactor: 移除不使用的方法
ArgoZhang Dec 30, 2024
562ecd3
refactor: 重构 AutoFill 组件
ArgoZhang Dec 30, 2024
7a291b5
doc: 更新示例文档
ArgoZhang Dec 30, 2024
e3383d3
doc: 更新文档说明按键支持 Esc
ArgoZhang Dec 30, 2024
60c535a
refactor: 增加关窗逻辑
ArgoZhang Dec 30, 2024
d4bf22b
refactor: 开窗增加条件判断
ArgoZhang Dec 30, 2024
6373fe9
refactor: 更新 Search 组件
ArgoZhang Dec 30, 2024
5d56fa0
refactor: 增加搜索按钮支持
ArgoZhang Dec 30, 2024
a312ade
feat: 增加搜索按钮逻辑
ArgoZhang Dec 30, 2024
ba29947
doc: 更新示例
ArgoZhang Dec 30, 2024
cf26091
doc: 更新示例
ArgoZhang Dec 30, 2024
9e3064f
refactor: 更改泛型约束
ArgoZhang Dec 30, 2024
cac7b10
refactor: 代码统一
ArgoZhang Dec 30, 2024
455d962
test: 更新单元测试
ArgoZhang Dec 30, 2024
53bd554
test: 增加防抖单元测试
ArgoZhang Dec 30, 2024
4a4241c
refactor: 移除不使用的属性
ArgoZhang Dec 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/BootstrapBlazor.Server/BootstrapBlazor.Server.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<PackageReference Include="BootstrapBlazor.Markdown" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.MaterialDesign" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.MaterialDesign.Extensions" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.MeiliSearch" Version="9.1.3" />
<PackageReference Include="BootstrapBlazor.MeiliSearch" Version="9.1.4" />
<PackageReference Include="BootstrapBlazor.Mermaid" Version="9.0.3" />
<PackageReference Include="BootstrapBlazor.MindMap" Version="9.0.0" />
<PackageReference Include="BootstrapBlazor.MouseFollower" Version="9.0.1" />
Expand Down
3 changes: 1 addition & 2 deletions src/BootstrapBlazor.Server/Components/Pages/Coms.razor
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
<div class="coms-search">
<div class="row">
<div class="col-12">
<Search PlaceHolder="@Localizer["Search"]" IsOnInputTrigger="true" IsAutoFocus="true"
Items="@ComponentItems" IsLikeMatch="true" IgnoreCase="true" OnSearch="@OnSearch"></Search>
<Search @bind-Value="@SearchText" PlaceHolder="@Localizer["Search"]" IsOnInputTrigger="true" IsAutoFocus="true" OnSearch="@OnSearch"></Search>
</div>
</div>
<div class="coms-search-filter">
Expand Down
8 changes: 3 additions & 5 deletions src/BootstrapBlazor.Server/Components/Pages/Coms.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,17 @@
namespace BootstrapBlazor.Server.Components.Pages;

/// <summary>
///
/// Coms 组件
/// </summary>
public sealed partial class Coms
{
private List<string> ComponentItems { get; } = [];

private string? SearchText { get; set; }

private Task OnSearch(string searchText)
private Task<IEnumerable<string>> OnSearch(string searchText)
{
SearchText = searchText;

StateHasChanged();
return Task.CompletedTask;
return Task.FromResult<IEnumerable<string>>(ComponentItems.Where(i => i.Contains(searchText, StringComparison.OrdinalIgnoreCase)));
}
}
27 changes: 15 additions & 12 deletions src/BootstrapBlazor.Server/Components/Samples/AutoCompletes.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,35 @@
<h4>@Localizer["Description"]</h4>

<DemoBlock Title="@Localizer["Block1Title"]" Introduction="@Localizer["Block1Intro"]" Name="Normal">
<p>@Localizer["NormalDescription"]</p>

<section ignore>@Localizer["NormalDescription"]</section>
<div style="width: 200px;">
<AutoComplete Items="@StaticItems" IsSelectAllTextOnFocus="true" />
</div>
</DemoBlock>

<DemoBlock Title="@Localizer["Block2Title"]" Introduction="@Localizer["Block2Intro"]" Name="LikeMatch">
<p>@Localizer["LikeMatchDescription"]</p>

<section ignore>@Localizer["LikeMatchDescription"]</section>
<div style="width: 200px;">
<AutoComplete Items="@StaticItems" IsLikeMatch="true" IgnoreCase="false" />
</div>
</DemoBlock>

<DemoBlock Title="@Localizer["Block3Title"]" Introduction="@Localizer["Block3Intro"]" Name="NoDataTip">
<p>@((MarkupString)Localizer["NoDataTipDescription"].Value)</p>

<section ignore>@((MarkupString)Localizer["NoDataTipDescription"].Value)</section>
<div style="width: 200px;">
<AutoComplete Items="@StaticItems" NoDataTip="@Localizer["NoDataTip"]" />
</div>
</DemoBlock>

<DemoBlock Title="@Localizer["Block4Title"]" Introduction="@Localizer["Block4Intro"]" Name="ValueChanged">
<p>@Localizer["ValueChangedDescription"]</p>

<section ignore>@Localizer["ValueChangedDescription"]</section>
<div style="width: 200px;">
<AutoComplete Items="@Items" ValueChanged="@OnValueChanged" />
</div>
</DemoBlock>

<DemoBlock Title="@Localizer["Block5Title"]" Introduction="@Localizer["Block5Intro"]" Name="ShowLabel">
<p>@((MarkupString)Localizer["ShowLabelDescription"].Value)</p>

<section ignore>@((MarkupString)Localizer["ShowLabelDescription"].Value)</section>
<Divider Text="@Localizer["Divider1Text"]" Alignment="Alignment.Left" style="margin: 2rem 0;"></Divider>
<ValidateForm Model="@Model">
<AutoComplete Items="@StaticItems" @bind-Value="@Model.Name" ShowLabel="true" />
Expand All @@ -51,15 +46,17 @@
</DemoBlock>

<DemoBlock Title="@Localizer["DebounceTitle"]" Introduction="@Localizer["DebounceIntro"]" Name="Debounce">
<p>@Localizer["DebounceDescription"]</p>
<section ignore>@Localizer["DebounceDescription"]</section>
<div style="width: 200px;">
<AutoComplete Items="@Items" ValueChanged="@OnValueChanged" Debounce="500" />
</div>
</DemoBlock>

<DemoBlock Title="@Localizer["OnSelectedItemChangedTitle"]" Introduction="@Localizer["OnSelectedItemChangedIntro"]" Name="OnSelectedItemChanged">
<AutoComplete Items="@StaticItems" OnSelectedItemChanged="OnSelectedItemChanged" Debounce="500"></AutoComplete>
<ConsoleLogger @ref="Logger" />
<section ignore>
<ConsoleLogger @ref="Logger" />
</section>
</DemoBlock>

<DemoBlock Title="@Localizer["ItemTemplateTitle"]" Introduction="@Localizer["ItemTemplateIntro"]" Name="ItemTemplate">
Expand Down Expand Up @@ -98,4 +95,10 @@
<ConsoleLogger @ref="GroupLogger" />
</DemoBlock>

<DemoBlock Title="@Localizer["PopoverTitle"]"
Introduction="@Localizer["PopoverIntro"]"
Name="Popover">
<AutoComplete Items="@StaticItems" IsPopover="true"></AutoComplete>
</DemoBlock>

<AttributeTable Items="@GetAttributes()" />
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
namespace BootstrapBlazor.Server.Components.Samples;

/// <summary>
///
/// AutoComplete 组件示例
/// </summary>
public sealed partial class AutoCompletes
{
Expand Down
34 changes: 19 additions & 15 deletions src/BootstrapBlazor.Server/Components/Samples/AutoFills.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
<h4>@Localizer["Description"]</h4>

<DemoBlock Title="@Localizer["NormalTitle"]" Introduction="@Localizer["NormalIntro"]" Name="Normal">
<div class="mb-3">
<section ignore>
@((MarkupString)@Localizer["NormalDesc"].Value)
</div>
<AutoFill TValue="Foo" Value="Model" Items="Items" IsLikeMatch="true" OnSelectedItemChanged="OnSelectedItemChanged"
OnGetDisplayText="OnGetDisplayText" class="mb-3" IsSelectAllTextOnFocus="true">
</section>
<AutoFill @bind-Value="Model1" Items="Items1" IsLikeMatch="true" OnGetDisplayText="OnGetDisplayText" class="mb-3" IsSelectAllTextOnFocus="true">
<Template>
<div class="d-flex">
<div>
Expand All @@ -23,14 +22,16 @@
</div>
</Template>
</AutoFill>
<img src="@WebsiteOption.CurrentValue.GetAvatarUrl(Model.Id)" class="shadow" style="width: 140px; margin-bottom: 1rem; border-radius: 6px;" />
<EditorForm Model="@Model" RowType="RowType.Inline" ItemsPerRow="2" />
<section ignore>
<img src="@WebsiteOption.CurrentValue.GetAvatarUrl(Model1.Id)" class="shadow" style="width: 140px; margin-bottom: 1rem; border-radius: 6px;" />
<EditorForm Model="@Model1" RowType="RowType.Inline" ItemsPerRow="2" />
</section>
</DemoBlock>

<DemoBlock Title="@Localizer["CustomFilterTitle"]" Introduction="@Localizer["CustomFilterIntro"]" Name="CustomFilter">
<div class="mb-3">@((MarkupString)Localizer["CustomFilterDesc"].Value)</div>
<AutoFill TValue="Foo" Value="Model" Items="Items" OnCustomFilter="OnCustomFilter"
OnSelectedItemChanged="OnSelectedItemChanged" OnGetDisplayText="OnGetDisplayText" class="mb-3">
<section ignore>@((MarkupString)Localizer["CustomFilterDesc"].Value)</section>
<AutoFill @bind-Value="Model2" Items="Items2" OnCustomFilter="OnCustomFilter"
OnGetDisplayText="OnGetDisplayText" class="mb-3">
<Template>
<div class="d-flex">
<div>
Expand All @@ -43,15 +44,16 @@
</div>
</Template>
</AutoFill>
<EditorForm Model="@Model" RowType="RowType.Inline" ItemsPerRow="2" />
<section ignore>
<EditorForm Model="@Model2" RowType="RowType.Inline" ItemsPerRow="2" />
</section>
</DemoBlock>

<DemoBlock Title="@Localizer["ShowDropdownListOnFocusTitle"]" Introduction="@Localizer["ShowDropdownListOnFocusIntro"]" Name="ShowDropdownListOnFocus">
<div class="mb-3">
<section ignore>
@((MarkupString)@Localizer["ShowDropdownListOnFocusDesc"].Value)
</div>
<AutoFill TValue="Foo" Value="Model" Items="Items" ShowDropdownListOnFocus="false"
OnGetDisplayText="OnGetDisplayText" class="mb-3">
</section>
<AutoFill @bind-Value="Model3" Items="Items3" ShowDropdownListOnFocus="false" OnGetDisplayText="OnGetDisplayText" class="mb-3">
<Template>
<div class="d-flex">
<div>
Expand All @@ -64,7 +66,9 @@
</div>
</Template>
</AutoFill>
<EditorForm Model="@Model" RowType="RowType.Inline" ItemsPerRow="2" />
<section ignore>
<EditorForm Model="@Model3" RowType="RowType.Inline" ItemsPerRow="2" />
</section>
</DemoBlock>

<AttributeTable Items="@GetAttributes()" />
48 changes: 29 additions & 19 deletions src/BootstrapBlazor.Server/Components/Samples/AutoFills.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,23 @@ namespace BootstrapBlazor.Server.Components.Samples;
partial class AutoFills
{
[NotNull]
private Foo Model { get; set; } = new();
private Foo Model1 { get; set; } = new();

private Task OnSelectedItemChanged(Foo foo)
{
Model = Utility.Clone(foo);
StateHasChanged();
return Task.CompletedTask;
}
[NotNull]
private Foo Model2 { get; set; } = new();
[NotNull]
private Foo Model3 { get; set; } = new();

private static string OnGetDisplayText(Foo foo) => foo.Name ?? "";

[NotNull]
private IEnumerable<Foo>? Items { get; set; }
private IEnumerable<Foo>? Items1 { get; set; }

[NotNull]
private IEnumerable<Foo>? Items2 { get; set; }

[NotNull]
private IEnumerable<Foo>? Items3 { get; set; }

[Inject]
[NotNull]
Expand All @@ -34,13 +38,19 @@ protected override void OnInitialized()
{
base.OnInitialized();

Items = Foo.GenerateFoo(LocalizerFoo);
Model = Items.First();
Items1 = Foo.GenerateFoo(LocalizerFoo);
Model1 = Items1.First();

Items2 = Foo.GenerateFoo(LocalizerFoo);
Model2 = Items2.First();

Items3 = Foo.GenerateFoo(LocalizerFoo);
Model3 = Items3.First();
}

private Task<IEnumerable<Foo>> OnCustomFilter(string searchText)
{
var items = string.IsNullOrEmpty(searchText) ? Items : Items.Where(i => i.Count > 50 && i.Name!.Contains(searchText));
var items = string.IsNullOrEmpty(searchText) ? Items2 : Items2.Where(i => i.Count > 50 && i.Name!.Contains(searchText));
return Task.FromResult(items);
}

Expand Down Expand Up @@ -122,14 +132,14 @@ private AttributeItem[] GetAttributes() =>
ValueList = " — ",
DefaultValue = " — "
},
new()
{
Name = nameof(AutoFill<Foo>.ShowDropdownListOnFocus),
Description = Localizer["Att10"],
Type = "bool",
ValueList = "true/false",
DefaultValue = "true"
},
//new()
//{
// Name = nameof(AutoFill<Foo>.ShowDropdownListOnFocus),
// Description = Localizer["Att10"],
// Type = "bool",
// ValueList = "true/false",
// DefaultValue = "true"
//},
new()
{
Name = "Template",
Expand Down
26 changes: 7 additions & 19 deletions src/BootstrapBlazor.Server/Components/Samples/Searches.razor
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@
<DemoBlock Title="@Localizer["SearchesNormalTitle"]"
Introduction="@Localizer["SearchesNormalIntro"]"
Name="Normal">
<p>@((MarkupString)Localizer["SearchesNormalDescription"].Value)</p>
<Search IgnoreCase="true"
IsLikeMatch="true"
IsAutoFocus="true"
<section ignore>@((MarkupString)Localizer["SearchesNormalDescription"].Value)</section>
<Search IsAutoFocus="true"
PlaceHolder="@Localizer["SearchesPlaceHolder"]"
Items="@Items"
OnSearch="@OnSearch"
IsSelectAllTextOnFocus="true" />
<ConsoleLogger @ref="Logger" />
Expand All @@ -22,23 +19,17 @@
<DemoBlock Title="@Localizer["SearchesClearValueTitle"]"
Introduction="@Localizer["SearchesClearValueIntro"]"
Name="ClearValue">
<Search IgnoreCase="true"
IsLikeMatch="true"
IsAutoClearAfterSearch="true"
<Search IsAutoClearAfterSearch="true"
PlaceHolder="@Localizer["SearchesPlaceHolder"]"
Items="@Items"
OnSearch="@OnClearSearch" />
<ConsoleLogger @ref="ClearLogger" />
</DemoBlock>

<DemoBlock Title="@Localizer["SearchesDisplayButtonTitle"]"
Introduction="@Localizer["SearchesDisplayButtonIntro"]"
Name="DisplayButton">
<Search IgnoreCase="true"
IsLikeMatch="true"
PlaceHolder="@Localizer["SearchesPlaceHolder"]"
<Search PlaceHolder="@Localizer["SearchesPlaceHolder"]"
ShowClearButton="true"
Items="@Items"
OnSearch="@OnDisplaySearch"
OnClear="@OnClear"></Search>
<ConsoleLogger @ref="DisplayLogger" />
Expand All @@ -47,11 +38,8 @@
<DemoBlock Title="@Localizer["SearchesKeyboardsTitle"]"
Introduction="@Localizer["SearchesKeyboardsIntro"]"
Name="keyboards">
<Search IgnoreCase="true"
IsLikeMatch="true"
PlaceHolder="@Localizer["SearchesPlaceHolder"]"
IsOnInputTrigger="true"
Items="@Items"
<Search PlaceHolder="@Localizer["SearchesPlaceHolder"]"
IsOnInputTrigger="false"
OnSearch="@OnKeyboardSearch" />
<ConsoleLogger @ref="KeyboardLogger" />
</DemoBlock>
Expand All @@ -60,7 +48,7 @@
Introduction="@Localizer["SearchesValidateFormIntro"]"
Name="ValidateForm">
<ValidateForm Model="@Model">
<Search Items="StaticItems" IsOnInputTrigger="true" @bind-Value="Model.Name" />
<Search IsOnInputTrigger="true" @bind-Value="Model.Name" />
</ValidateForm>
</DemoBlock>

Expand Down
Loading
Loading