Skip to content

Commit c234b76

Browse files
WilliamLiu1997sourcery-ai[bot]ArgoZhang
authored
feat(SelectTree): add CanExpandWhenDisabled parameter (#6128)
* 获取或设置当SelectTree 节点处于禁用状态时,节点是否可以展开或折叠。默认值为 false。 * test: 增加单元测试 * chore: bump version beta02 Co-Authored-By: WilliamLiu1997 <[email protected]> * chore: bump version 9.7.1-beta03 --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> Co-authored-by: Admin <Admin> Co-authored-by: Argo Zhang <[email protected]>
1 parent 8b47783 commit c234b76

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

src/BootstrapBlazor/Components/Select/SelectTree.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
<TreeView TItem="TValue" Items="@Items" ShowIcon="ShowIcon"
2424
OnTreeItemClick="OnItemClick" ModelEqualityComparer="@ModelEqualityComparer"
2525
ShowSearch="ShowSearch" ShowResetSearchButton="ShowResetSearchButton"
26+
CanExpandWhenDisabled="CanExpandWhenDisabled"
2627
CustomKeyAttribute="@CustomKeyAttribute" OnExpandNodeAsync="@OnExpandNodeAsync" />
2728
</div>
2829
@if (!IsPopover)

src/BootstrapBlazor/Components/Select/SelectTree.razor.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ public partial class SelectTree<TValue> : IModelEqualityComparer<TValue>
5151
[Parameter]
5252
public string? PlaceHolder { get; set; }
5353

54+
/// <summary>
55+
/// Gets or sets whether nodes can be expanded or collapsed when the component is disabled. Default is false.
56+
/// </summary>
57+
[Parameter]
58+
public bool CanExpandWhenDisabled { get; set; } = false;
59+
5460
/// <summary>
5561
/// 获得/设置 字符串比较规则 默认 StringComparison.OrdinalIgnoreCase 大小写不敏感
5662
/// </summary>

test/UnitTest/Components/SelectTreeTest.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ public void Items_Ok()
1212
{
1313
var cut = Context.RenderComponent<SelectTree<string>>(builder =>
1414
{
15+
builder.Add(a => a.CanExpandWhenDisabled, false);
1516
builder.Add(p => p.ShowIcon, true);
1617
builder.Add(p => p.ModelEqualityComparer, (s1, s2) => { return true; });
1718
builder.Add(p => p.OnExpandNodeAsync, (s) => { return Task.FromResult(new List<TreeViewItem<string>>().AsEnumerable()); });

0 commit comments

Comments
 (0)