ant-design-blazor/components/tree/TreeIndent.razor.cs
琢磨先生 300123045f refactor(module: tree): add draggable, fix default value binding (#1517)
* 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>
2021-07-11 18:43:25 +08:00

43 lines
1.2 KiB
C#

// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.AspNetCore.Components;
namespace AntDesign
{
public partial class TreeIndent<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; }
[Parameter]
public int TreeLevel { get; set; }
/// <summary>
/// To find specific level parent node
/// </summary>
/// <param name="node"></param>
/// <param name="level"></param>
/// <returns></returns>
private static TreeNode<TItem> GetParentNode(TreeNode<TItem> node, int level)
{
if (level > 0 && node.ParentNode != null)
{
return GetParentNode(node.ParentNode, level - 1);
}
return node;
}
}
}