2021-07-11 18:43:25 +08:00
|
|
|
|
// 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.
|
|
|
|
|
|
2020-10-09 15:13:32 +08:00
|
|
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
|
|
|
|
|
|
namespace AntDesign
|
|
|
|
|
{
|
2021-01-10 18:49:52 +08:00
|
|
|
|
public partial class TreeIndent<TItem> : ComponentBase
|
2020-10-09 15:13:32 +08:00
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2021-07-11 18:43:25 +08:00
|
|
|
|
/// Root Tree
|
2020-10-09 15:13:32 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
[CascadingParameter(Name = "Tree")]
|
2020-12-30 18:38:35 +08:00
|
|
|
|
public Tree<TItem> TreeComponent { get; set; }
|
2020-10-09 15:13:32 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2021-07-11 18:43:25 +08:00
|
|
|
|
/// Current Node
|
2020-10-09 15:13:32 +08:00
|
|
|
|
/// </summary>
|
|
|
|
|
[CascadingParameter(Name = "SelfNode")]
|
2020-12-30 18:38:35 +08:00
|
|
|
|
public TreeNode<TItem> SelfNode { get; set; }
|
2020-10-09 15:13:32 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public int TreeLevel { get; set; }
|
2021-07-11 18:43:25 +08:00
|
|
|
|
|
|
|
|
|
/// <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;
|
|
|
|
|
}
|
2020-10-09 15:13:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|