mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-14 17:01:18 +08:00
f904676578
* Tree: 1.add new node action 2.fixed data sort selection issue 3.add Expand() Collapse() Toggle() * fixed Tree.OnRendered summary * remove the `Is` prefix * refactor(tree): renaming Co-authored-by: 王的强 <wdq@sinotex.cn> Co-authored-by: ElderJames <shunjiey@hotmail.com>
54 lines
1.5 KiB
C#
54 lines
1.5 KiB
C#
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
|
|
namespace AntDesign
|
|
{
|
|
public partial class TreeNodeCheckbox<TItem> : AntDomComponentBase
|
|
{
|
|
/// <summary>
|
|
/// 树控件本身
|
|
/// </summary>
|
|
[CascadingParameter(Name = "Tree")]
|
|
public Tree<TItem> TreeComponent { get; set; }
|
|
|
|
/// <summary>
|
|
/// 当前节点
|
|
/// </summary>
|
|
[CascadingParameter(Name = "SelfNode")]
|
|
public TreeNode<TItem> SelfNode { get; set; }
|
|
|
|
protected ClassMapper ClassMapper { get; } = new ClassMapper();
|
|
|
|
private void SetClassMap()
|
|
{
|
|
ClassMapper.Clear().Add("ant-tree-checkbox")
|
|
.If("ant-tree-checkbox-checked", () => SelfNode.Checked)
|
|
.If("ant-tree-checkbox-indeterminate", () => SelfNode.Indeterminate)
|
|
.If("ant-tree-checkbox-disabled", () => SelfNode.Disabled || SelfNode.DisableCheckbox)
|
|
;
|
|
}
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
SetClassMap();
|
|
base.OnInitialized();
|
|
}
|
|
|
|
protected override void OnParametersSet()
|
|
{
|
|
SetClassMap();
|
|
base.OnParametersSet();
|
|
}
|
|
|
|
[Parameter]
|
|
public EventCallback<MouseEventArgs> OnCheckBoxClick { get; set; }
|
|
|
|
private async Task OnClick(MouseEventArgs args)
|
|
{
|
|
if (OnCheckBoxClick.HasDelegate)
|
|
await OnCheckBoxClick.InvokeAsync(args);
|
|
}
|
|
}
|
|
}
|