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
1 change: 1 addition & 0 deletions src/BootstrapBlazor/Components/Select/SelectTree.razor
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
<TreeView TItem="TValue" Items="@Items" ShowIcon="ShowIcon"
OnTreeItemClick="OnItemClick" ModelEqualityComparer="@ModelEqualityComparer"
ShowSearch="ShowSearch" ShowResetSearchButton="ShowResetSearchButton"
CanExpandWhenDisabled="CanExpandWhenDisabled"
CustomKeyAttribute="@CustomKeyAttribute" OnExpandNodeAsync="@OnExpandNodeAsync" />
</div>
@if (!IsPopover)
Expand Down
6 changes: 6 additions & 0 deletions src/BootstrapBlazor/Components/Select/SelectTree.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ public partial class SelectTree<TValue> : IModelEqualityComparer<TValue>
[Parameter]
public string? PlaceHolder { get; set; }

/// <summary>
/// Gets or sets whether nodes can be expanded or collapsed when the component is disabled. Default is false.
/// </summary>
[Parameter]
public bool CanExpandWhenDisabled { get; set; } = false;

/// <summary>
/// 获得/设置 字符串比较规则 默认 StringComparison.OrdinalIgnoreCase 大小写不敏感
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions test/UnitTest/Components/SelectTreeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ public void Items_Ok()
{
var cut = Context.RenderComponent<SelectTree<string>>(builder =>
{
builder.Add(a => a.CanExpandWhenDisabled, false);
builder.Add(p => p.ShowIcon, true);
builder.Add(p => p.ModelEqualityComparer, (s1, s2) => { return true; });
builder.Add(p => p.OnExpandNodeAsync, (s) => { return Task.FromResult(new List<TreeViewItem<string>>().AsEnumerable()); });
Expand Down