
AutoFill components
Auto-fill forms when selected via IntelliSense prompt option
fill the form
Demo
Name
Name smart prompt, automatically fill in the form below after selecting the prompt item Currently supports keyboard Enter Spance 
Filter data by setting custom filter condition callback delegate OnCustomFilter
Demo
name
intelligent prompt, and delegate OnCustomFilter
to filter data by setting a user-defined filter condition callback. The current filter condition is that Name
contains the input string Count
and the value is greater than 50By setting ShowDropdownListOnFocus="false"
Demo
ShowDropdownListOnFocus
the default value is true
. After the component gets the focus, it will automatically expand the candidate drop-down box, set to false
turn off this featureAttributes
@page "/autofills"
@inject IStringLocalizer<AutoFills> Localizer
<h3>AutoFill components</h3>
<h4>Auto-fill forms when selected via IntelliSense prompt option</h4>
<DemoBlock Title="Basic usage" Introduction="fill the form"
Name="Normal" Demo="typeof(Demos.AutoFill.AutoFillNormal)">
<div class="mb-3">
@((MarkupString)input <code>Name</code> Name smart prompt, automatically fill in the form below after selecting the prompt item Currently supports keyboard <kbd>Enter</kbd> <kbd>Spance</kbd> <kbd><i class="fa-solid fa-arrow-up"></i></kbd> <kbd><i class="fa-solid fa-arrow-down"></i></kbd>.Value)
</div>
</DemoBlock>
<DemoBlock Title="custom filter" Introduction="Filter data by setting custom filter condition callback delegate <code>OnCustomFilter</code>"
Name="CustomFilter" Demo="typeof(Demos.AutoFill.AutoFillCustomFilter)">
<div class="mb-3">Enter the <code>name</code> intelligent prompt, and delegate <code>OnCustomFilter</code> to filter data by setting a user-defined filter condition callback. The current filter condition is that <code>Name</code> contains the input string <code>Count</code> and the value is greater than <b>50</b></div>
</DemoBlock>
<DemoBlock Title="Turn off auto-expand dropdown" Introduction="By setting <code>ShowDropdownListOnFocus="false"</code>"
Name="ShowDropdownListOnFocus" Demo="typeof(Demos.AutoFill.AutoFillShowDropdownListOnFocus)">
<div class="mb-3">
@((MarkupString)parameter <code>ShowDropdownListOnFocus</code> the default value is <code>true</code>. After the component gets the focus, it will automatically expand the candidate drop-down box, set to <code>false</code> turn off this feature.Value)
</div>
</DemoBlock>
<AttributeTable Items="@GetAttributes()" />
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Website: https://www.blazor.zone or https://argozhang.github.io/
namespace BootstrapBlazor.Shared.Samples;
/// <summary>
///
/// </summary>
partial class AutoFills
{
/// <summary>
/// Get property method
/// </summary>
/// <returns></returns>
private IEnumerable<AttributeItem> GetAttributes() => new[]
{
// TODO: move to database
new AttributeItem() {
Name = "DisplayCount",
Description = Localizer["Att1"],
Type = "int",
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem() {
Name = "NoDataTip",
Description = Localizer["Att2"],
Type = "string",
ValueList = " — ",
DefaultValue = Localizer["Def2"]
},
new AttributeItem() {
Name = "IgnoreCase",
Description = Localizer["Att3"],
Type = "bool",
ValueList = "true/false",
DefaultValue = "true"
},
new AttributeItem() {
Name = "IsLikeMatch",
Description = Localizer["Att4"],
Type = "bool",
ValueList = "true/false",
DefaultValue = "false"
},
new AttributeItem() {
Name = "Items",
Description = Localizer["Att5"],
Type = "IEnumerable<TValue>",
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem()
{
Name = "Debounce",
Description = Localizer["Att6"],
Type = "int",
ValueList = " — ",
DefaultValue = "0"
},
new AttributeItem() {
Name = "OnCustomFilter",
Description = Localizer["Att7"],
Type = "Func<string, Task<IEnumerable<TValue>>>",
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem() {
Name = "OnGetDisplayText",
Description = Localizer["Att8"],
Type = "Func<TValue, string>",
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem() {
Name = "OnSelectedItemChanged",
Description = Localizer["Att9"],
Type = "Func<TValue, Task>",
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem() {
Name = nameof(AutoFill<Foo>.ShowDropdownListOnFocus),
Description = Localizer["Att10"],
Type = "bool",
ValueList = "true/false",
DefaultValue = "true"
},
new AttributeItem() {
Name = "Template",
Description = Localizer["Att11"],
Type = "RenderFragment<TValue>",
ValueList = " — ",
DefaultValue = " — "
},
new AttributeItem()
{
Name = nameof(AutoFill<string>.SkipEnter),
Description = Localizer["Att12"],
Type = "bool",
ValueList = "true/false",
DefaultValue = "false"
},
new AttributeItem()
{
Name = nameof(AutoFill<string>.SkipEsc),
Description = Localizer["Att13"],
Type = "bool",
ValueList = "true/false",
DefaultValue = "false"
}
};
}