Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 4 additions & 16 deletions src/BootstrapBlazor.Server/Components/Samples/MultiSelects.razor
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,6 @@ private enum MultiSelectEnumFoo
<section ignore>
<p>@((MarkupString)Localizer["MultiSelectSearchDescription"].Value)</p>
<div class="row g-3">
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="IsFixedSearch" />
<Checkbox @bind-Value="@_isFixedSearch" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="IsClearable" />
Expand All @@ -135,12 +129,12 @@ private enum MultiSelectEnumFoo
<div class="row g-3">
<div class="col-12 col-sm-6">
<MultiSelect Items="@Items" @bind-Value="@SelectedSearchItemsValue"
ShowSearch="true" IsFixedSearch="_isFixedSearch" IsClearable="_isClearable" OnSearchTextChanged="@OnSearch">
ShowSearch="true" IsClearable="_isClearable" OnSearchTextChanged="@OnSearch">
</MultiSelect>
</div>
<div class="col-12 col-sm-6">
<MultiSelect Items="@LongItems" @bind-Value="@SelectedMaxItemsValue"
ShowSearch="true" IsFixedSearch="_isFixedSearch" IsClearable="_isClearable">
ShowSearch="true" IsClearable="_isClearable">
</MultiSelect>
</div>
</div>
Expand Down Expand Up @@ -313,12 +307,6 @@ private enum MultiSelectEnumFoo
<Checkbox @bind-Value="@_showSearch" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="IsFixedSearch" />
<Checkbox @bind-Value="@_isFixedSearch" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="ShowToolbar" />
Expand All @@ -339,7 +327,7 @@ private enum MultiSelectEnumFoo
<div class="col-6">
<MultiSelect IsVirtualize="true" @bind-Value="_virtualItemString1" OnQueryAsync="OnQueryAsync"
ShowSearch="_showSearch" ShowToolbar="_showToolbar"
IsFixedSearch="_isFixedSearch" IsClearable="_isClearable">
IsClearable="_isClearable">
</MultiSelect>
</div>
<div class="col-6">
Expand All @@ -352,7 +340,7 @@ private enum MultiSelectEnumFoo
<div class="col-6">
<MultiSelect IsVirtualize="true" @bind-Value="_virtualItemString2" Items="VirtualItems"
ShowSearch="_showSearch" ShowToolbar="_showToolbar"
IsFixedSearch="_isFixedSearch" IsClearable="_isClearable">
IsClearable="_isClearable">
</MultiSelect>
</div>
<div class="col-6">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,6 @@ private enum MultiSelectEnumFoo
private IEnumerable<SelectedItem> VirtualItems => Foos.Select(i => new SelectedItem(i.Name!, i.Name!)).ToList();

private string? _editString;

private bool _isFixedSearch = true;
private bool _isClearable = true;
private bool _showToolbar = true;
private bool _showSearch = true;
Expand Down Expand Up @@ -382,14 +380,6 @@ private AttributeItem[] GetAttributes() =>
DefaultValue = "false"
},
new()
{
Name = "IsFixedSearch",
Description = Localizer["MultiSelectsAttribute_IsFixedSearch"],
Type = "bool",
ValueList = "true|false",
DefaultValue = "false"
},
new()
{
Name = "ShowToolbar",
Description = Localizer["MultiSelectsAttribute_ShowToolbar"],
Expand Down
20 changes: 4 additions & 16 deletions src/BootstrapBlazor.Server/Components/Samples/Selects.razor
Original file line number Diff line number Diff line change
Expand Up @@ -323,23 +323,17 @@
<Checkbox @bind-Value="@_isShowSearchClearable" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="IsFixedSearch" />
<Checkbox @bind-Value="@_isFixedSearch" />
</BootstrapInputGroup>
</div>
</div>
</section>
<div class="row g-3">
<div class="col-12 col-sm-6">
<Select TValue="string" Items="Items" ShowSearch="true"
IsClearable="_isShowSearchClearable" IsFixedSearch="_isFixedSearch">
IsClearable="_isShowSearchClearable">
</Select>
</div>
<div class="col-12 col-sm-6">
<Select TValue="string" Items="StringItems" ShowSearch="true"
IsClearable="_isShowSearchClearable" IsFixedSearch="_isFixedSearch">
IsClearable="_isShowSearchClearable">
</Select>
</div>
</div>
Expand Down Expand Up @@ -440,12 +434,6 @@
<Checkbox @bind-Value="@_showSearch" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="IsFixedSearch" />
<Checkbox @bind-Value="@_isFixedSearch" />
</BootstrapInputGroup>
</div>
<div class="col-12 col-sm-6">
<BootstrapInputGroup>
<BootstrapInputGroupLabel DisplayText="IsClearable" />
Expand All @@ -459,7 +447,7 @@
<div class="row mb-3">
<div class="col-6">
<Select IsVirtualize="true" OnQueryAsync="OnQueryAsync" @bind-Value="VirtualItem1"
ShowSearch="_showSearch" IsFixedSearch="_isFixedSearch" IsClearable="_isClearable"></Select>
ShowSearch="_showSearch" IsClearable="_isClearable"></Select>
</div>
<div class="col-6">
<Display TValue="string" Value="@VirtualItem1?.Text"></Display>
Expand All @@ -470,7 +458,7 @@
<div class="row">
<div class="col-6">
<Select IsVirtualize="true" Items="VirtualItems" @bind-Value="VirtualItem2"
ShowSearch="_showSearch" IsFixedSearch="_isFixedSearch" IsClearable="_isClearable"></Select>
ShowSearch="_showSearch" IsClearable="_isClearable"></Select>
</div>
<div class="col-6">
<Display TValue="string" Value="@VirtualItem2?.Text"></Display>
Expand Down
20 changes: 3 additions & 17 deletions src/BootstrapBlazor.Server/Components/Samples/Selects.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,10 @@ public sealed partial class Selects
[NotNull]
private IStringLocalizer<Foo>? LocalizerFoo { get; set; }

private bool _showSearch;

private bool _showSearch = true;
private bool _showPopoverSearch = true;

private bool _isShowSearchClearable;

private bool _isFixedSearch;

private bool _isClearable;

private bool _isShowSearchClearable = true;
private bool _isClearable = true;
private string? _fooName;

private readonly List<SelectedItem> _enumValueDemoItems = [
Expand Down Expand Up @@ -359,14 +353,6 @@ private AttributeItem[] GetAttributes() =>
DefaultValue = "false"
},
new()
{
Name = "IsFixedSearch",
Description = Localizer["SelectsIsFixedSearch"],
Type = "boolean",
ValueList = "true / false",
DefaultValue = "false"
},
new()
{
Name = "IsDisabled",
Description = Localizer["SelectsIsDisabled"],
Expand Down
6 changes: 2 additions & 4 deletions src/BootstrapBlazor.Server/Locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -3028,8 +3028,7 @@
"MultiSelectVirtualizeTitle": "Virtualize",
"MultiSelectVirtualizeIntro": "Set <code>IsVirtualize</code> to <b>true</b> enable virtual scroll for large data",
"MultiSelectVirtualizeDescription": "Component virtual scrolling supports two ways of providing data through <code>Items</code> or <code>OnQueryAsync</code> callback methods",
"MultiSelectsAttribute_ShowSearch": "Whether to display the search box",
"MultiSelectsAttribute_IsFixedSearch": "Whether fixed the search box"
"MultiSelectsAttribute_ShowSearch": "Whether to display the search box"
},
"BootstrapBlazor.Server.Components.Samples.Radios": {
"RadiosTitle": "Radio",
Expand Down Expand Up @@ -3205,8 +3204,7 @@
"SelectsGenericDesc": "<p>Please refer to <a href=\"https://github.com/dotnetcore/BootstrapBlazor/issues/4497?wt.mc_id=DT-MVP-5004174\" target=\"_blank\">Design Ideas</a> to understand this feature. In this example, by selecting the drop-down box option, the value obtained is the <code>Foo</code> instance, and the value displayed in the text box on the right is the <code>Address</code> value of the <code>Foo</code> attribute</p><p>In this example, the <code>ValueEqualityComparer</code> and <code>CustomKeyAttribute</code> parameters are not set, and the <code>[Key]</code> tag of the <code>Id</code> attribute of <code>Foo</code> is used for equality judgment</p>",
"SelectsOnInputChangedCallback": "Callback method for converting input text into corresponding Value in edit mode",
"TextConvertToValueCallback": "Callback method when input text changes in edit mode",
"SelectsIsEditable": "Whether editable",
"SelectsIsFixedSearch": "Whether fixed the search box"
"SelectsIsEditable": "Whether editable"
},
"BootstrapBlazor.Server.Components.Samples.Sliders": {
"SlidersTitle": "Slider",
Expand Down
6 changes: 2 additions & 4 deletions src/BootstrapBlazor.Server/Locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3028,8 +3028,7 @@
"MultiSelectVirtualizeTitle": "虚拟滚动",
"MultiSelectVirtualizeIntro": "通过设置 <code>IsVirtualize</code> 参数开启组件虚拟功能特性",
"MultiSelectVirtualizeDescription": "组件虚拟滚动支持两种形式通过 <code>Items</code> 或者 <code>OnQueryAsync</code> 回调方法提供数据",
"MultiSelectsAttribute_ShowSearch": "是否显示搜索框",
"MultiSelectsAttribute_IsFixedSearch": "是否固定搜索栏"
"MultiSelectsAttribute_ShowSearch": "是否显示搜索框"
},
"BootstrapBlazor.Server.Components.Samples.Radios": {
"RadiosTitle": "Radio 单选框",
Expand Down Expand Up @@ -3205,8 +3204,7 @@
"SelectsGenericDesc": "<p>请参考 <a href=\"https://github.com/dotnetcore/BootstrapBlazor/issues/4497?wt.mc_id=DT-MVP-5004174\" target=\"_blank\">设计思路</a> 理解此功能。本例中通过选择下拉框选项,得到的值为 <code>Foo</code> 实例,右侧文本框内显示值为 <code>Foo</code> 属性 <code>Address</code> 值</p><p>本例中未设置 <code>ValueEqualityComparer</code> 以及 <code>CustomKeyAttribute</code> 参数,使用 <code>Foo</code> 属性 <code>Id</code> 的 <code>[Key]</code> 标签进行相等判定</p>",
"SelectsOnInputChangedCallback": "编辑模式下输入文本转换为对应 Value 回调方法",
"TextConvertToValueCallback": "编辑模式下输入文本变化时回调方法",
"SelectsIsEditable": "是否可编辑",
"SelectsIsFixedSearch": "是否固定搜索栏"
"SelectsIsEditable": "是否可编辑"
},
"BootstrapBlazor.Server.Components.Samples.Sliders": {
"SlidersTitle": "Slider 滑块",
Expand Down
2 changes: 2 additions & 0 deletions src/BootstrapBlazor/Attributes/AutoGenerateColumnAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ public class AutoGenerateColumnAttribute : AutoGenerateBaseAttribute, ITableColu
/// <summary>
/// <inheritdoc/>
/// </summary>
[Obsolete("已弃用,请删除;Deprecated, please delete")]
[ExcludeFromCodeCoverage]
public bool IsFixedSearchWhenSelect { get; set; }

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/BootstrapBlazor/Components/EditorForm/EditorItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ public class EditorItem<TModel, TValue> : ComponentBase, IEditorItem
/// <inheritdoc/>
/// </summary>
[Parameter]
[Obsolete("已弃用,请删除;Deprecated, please delete")]
[ExcludeFromCodeCoverage]
public bool IsFixedSearchWhenSelect { get; set; }

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/BootstrapBlazor/Components/EditorForm/IEditorItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public interface IEditorItem : ILookup
/// <summary>
/// Gets or sets whether to allow fixed search box within dropdown. Default is false.
/// </summary>
[Obsolete("已弃用,请删除;Deprecated, please delete")]
[ExcludeFromCodeCoverage]
bool IsFixedSearchWhenSelect { get; set; }

/// <summary>
Expand Down
2 changes: 2 additions & 0 deletions src/BootstrapBlazor/Components/Filters/LookupFilter.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public partial class LookupFilter : ILookup
/// 获得 是否为 ShowSearch 呈现模式 默认为 false
/// </summary>
[Parameter]
[ExcludeFromCodeCoverage]
[Obsolete("已弃用,请删除;Deprecated, please delete")]
public bool IsFixedSearch { get; set; }

[Inject]
Expand Down
4 changes: 3 additions & 1 deletion src/BootstrapBlazor/Components/Filters/TableFilter.razor
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ else
}
else if (Column.IsLookup())
{
<LookupFilter Lookup="Column.Lookup" LookupService="Column.LookupService" LookupServiceKey="@Column.LookupServiceKey" LookupServiceData="Column.LookupServiceData" LookupStringComparison="Column.LookupStringComparison" Type="Column.PropertyType" IsShowSearch="Column.ShowSearchWhenSelect" IsFixedSearch="Column.IsFixedSearchWhenSelect"></LookupFilter>
<LookupFilter Lookup="Column.Lookup" LookupService="Column.LookupService" LookupServiceKey="@Column.LookupServiceKey"
LookupServiceData="Column.LookupServiceData" LookupStringComparison="Column.LookupStringComparison"
Type="Column.PropertyType" IsShowSearch="Column.ShowSearchWhenSelect"></LookupFilter>
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/Components/Select/MultiSelect.razor
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
{
<span class="@ClearClassString" @onclick="OnClearValue"><i class="@ClearableIcon"></i></span>
}
<div class="@MultipleDropdownMenuClassString">
<div class="@DropdownMenuClassString">
@if (ShowSearch)
{
<div class="dropdown-menu-search">
Expand Down
8 changes: 1 addition & 7 deletions src/BootstrapBlazor/Components/Select/MultiSelect.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public partial class MultiSelect<TValue>
.AddClass("is-clearable", IsClearable)
.Build();

private string? MultipleDropdownMenuClassString => CssBuilder.Default(DropdownMenuClassString)
private string? DropdownMenuClassString => CssBuilder.Default("dropdown-menu")
.AddClass("is-fixed-toolbar", ShowToolbar)
.Build();

Expand Down Expand Up @@ -295,12 +295,6 @@ protected override List<SelectedItem> GetRowsByItems()
return items;
}

/// <summary>
/// <inheritdoc/>
/// </summary>
/// <returns></returns>
protected override bool CheckFixedSearch() => ShowToolbar ? true : base.CheckFixedSearch();

/// <summary>
/// 客户端回车回调方法
/// </summary>
Expand Down
7 changes: 3 additions & 4 deletions src/BootstrapBlazor/Components/Select/MultiSelect.razor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,16 @@
.dropdown-menu {
&.is-fixed-toolbar {
--bb-dropdown-max-height: 330px;
--bb-dropdown-toolbar-height: 38px;

.dropdown-menu-body {
max-height: calc(var(--bb-dropdown-max-height) - 48px);
overflow: auto;
max-height: calc(var(--bb-dropdown-max-height) - var(--bb-dropdown-toolbar-height));
}
}

&.is-fixed-search.is-fixed-toolbar {
.dropdown-menu-body {
max-height: calc(var(--bb-dropdown-max-height) - 117px);
overflow: auto;
max-height: calc(var(--bb-dropdown-max-height) - var(--bb-select-search-height) - var(--bb-dropdown-toolbar-height));
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/Components/Select/Select.razor
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
{
<span class="@ClearClassString" @onclick="OnClearValue"><i class="@ClearIcon"></i></span>
}
<div class="@DropdownMenuClassString">
<div class="dropdown-menu">
@if (ShowSearch)
{
<div class="dropdown-menu-search">
Expand Down
44 changes: 13 additions & 31 deletions src/BootstrapBlazor/Components/Select/Select.razor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,11 @@
--bb-select-focus-shadow: #{$bb-select-focus-shadow};
--bb-select-padding-right: #{$bb-select-padding-right};
--bb-select-padding: #{$bb-select-padding};
--bb-select-search-padding: #{$bb-select-search-padding};
--bb-select-search-margin-bottom: #{$bb-select-search-margin-bottom};
--bb-select-search-border-color: #{$bb-select-search-border-color};
--bb-select-search-padding-right: #{$bb-select-search-padding-right};
--bb-select-search-icon-color: #{$bb-select-search-icon-color};
--bb-select-search-icon-right: #{$bb-select-search-icon-right};
--bb-select-search-icon-top: #{$bb-select-search-icon-top};
--bb-select-search-height: #{$bb-select-search-height};
--bb-select-append-width: #{$bb-select-append-width};
--bb-select-append-color: #{$bb-select-append-color};
}

.select:not(.cascade) .dropdown-menu {
overflow-x: hidden;
width: 100%;
}

Expand Down Expand Up @@ -48,22 +39,6 @@
background-color: var(--bs-secondary-bg);
}

.dropdown-menu {
--bs-dropdown-border-radius: var(--bs-border-radius);
overflow: auto;
max-height: var(--bb-dropdown-max-height);
}

.dropdown-menu .dropdown-virtual {
overflow-y: auto;
margin: calc(0px - var(--bs-dropdown-padding-y)) var(--bs-dropdown-padding-x);
padding: var(--bs-dropdown-padding-y) var(--bs-dropdown-padding-x);
}

.dropdown-menu .search + .dropdown-virtual {
max-height: calc(var(--bb-dropdown-max-height) - var(--bb-select-search-height));
}

.dropdown-item {
cursor: pointer;
}
Expand Down Expand Up @@ -209,12 +184,14 @@
}

.dropdown-menu {
&.is-fixed-search {
.dropdown-menu-body {
max-height: calc(var(--bb-dropdown-max-height) - 76px);
overflow: auto;
}
}
--bb-select-search-padding: #{$bb-select-search-padding};
--bb-select-search-margin-bottom: #{$bb-select-search-margin-bottom};
--bb-select-search-padding-right: #{$bb-select-search-padding-right};
--bb-select-search-border-color: #{$bb-select-search-border-color};
--bb-select-search-icon-color: #{$bb-select-search-icon-color};
--bb-select-search-icon-right: #{$bb-select-search-icon-right};
--bb-select-search-icon-top: #{$bb-select-search-icon-top};
--bb-select-search-height: #{$bb-select-search-height};

.dropdown-menu-search {
padding: var(--bb-select-search-padding);
Expand All @@ -237,6 +214,11 @@
}
}

.dropdown-menu-body {
max-height: var(--bb-dropdown-max-height);
overflow: auto;
}

.search-text {
padding-inline-end: var(--bb-select-search-padding-right);
}
Expand Down
Loading