mirror of
https://gitee.com/ant-design-blazor/ant-design-blazor.git
synced 2024-12-05 13:37:35 +08:00
300123045f
* delete demo docs * fix tree default value and dnd * fix tree line and keys * fix switcher icon and line * fix line demo * fix switcher * add DirectoryTree demo * fix draggable demo * clean code * clean code * clean up the classmapper call * update docs * fix the docs * fix comment Co-authored-by: James Yeung <shunjiey@hotmail.com>
48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
using System.Threading.Tasks;
|
|
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.AspNetCore.Components.Web;
|
|
|
|
namespace AntDesign
|
|
{
|
|
public partial class TreeNodeCheckbox<TItem> : ComponentBase
|
|
{
|
|
/// <summary>
|
|
/// Root Tree
|
|
/// </summary>
|
|
[CascadingParameter(Name = "Tree")]
|
|
public Tree<TItem> TreeComponent { get; set; }
|
|
|
|
/// <summary>
|
|
/// Current Node
|
|
/// </summary>
|
|
[CascadingParameter(Name = "SelfNode")]
|
|
public TreeNode<TItem> SelfNode { get; set; }
|
|
|
|
protected ClassMapper ClassMapper { get; } = new ClassMapper();
|
|
|
|
private void SetClassMap()
|
|
{
|
|
ClassMapper
|
|
.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();
|
|
}
|
|
|
|
[Parameter]
|
|
public EventCallback<MouseEventArgs> OnCheckBoxClick { get; set; }
|
|
|
|
private async Task OnClick(MouseEventArgs args)
|
|
{
|
|
if (OnCheckBoxClick.HasDelegate)
|
|
await OnCheckBoxClick.InvokeAsync(args);
|
|
}
|
|
}
|
|
}
|