2020-10-09 15:13:32 +08:00
|
|
|
|
@namespace AntDesign
|
2021-01-10 18:49:52 +08:00
|
|
|
|
@inherits ComponentBase
|
2020-12-30 18:38:35 +08:00
|
|
|
|
@typeparam TItem
|
2020-10-09 15:13:32 +08:00
|
|
|
|
|
|
|
|
|
<span class="@ClassMapper.Class" @onclick="OnClick">
|
2021-07-11 18:43:25 +08:00
|
|
|
|
@if (SelfNode.Loading)
|
2020-10-09 15:13:32 +08:00
|
|
|
|
{
|
2021-07-11 18:43:25 +08:00
|
|
|
|
<Icon Type="loading" Theme="outline" Class="ant-tree-switcher-loading-icon" />
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<!-- node has its own switcher icon -->
|
|
|
|
|
@if (SelfNode?.SwitcherIconTemplate != null || SelfNode?.SwitcherIcon != null)
|
2020-10-09 15:13:32 +08:00
|
|
|
|
{
|
2021-07-11 18:43:25 +08:00
|
|
|
|
if (SelfNode.SwitcherIconTemplate != null)
|
2020-10-09 15:13:32 +08:00
|
|
|
|
{
|
2021-07-11 18:43:25 +08:00
|
|
|
|
<span class="ant-tree-switcher-icon">
|
|
|
|
|
@SelfNode.SwitcherIconTemplate(SelfNode)
|
|
|
|
|
</span>
|
2020-10-09 15:13:32 +08:00
|
|
|
|
}
|
2021-07-11 18:43:25 +08:00
|
|
|
|
else if (SelfNode.SwitcherIcon != null)
|
2020-10-09 15:13:32 +08:00
|
|
|
|
{
|
2021-07-11 18:43:25 +08:00
|
|
|
|
<Icon Type="@SelfNode.SwitcherIcon" Class="ant-tree-switcher-icon" />
|
2020-10-09 15:13:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-07-11 18:43:25 +08:00
|
|
|
|
@if (TreeComponent.ShowLine)
|
2020-10-09 15:13:32 +08:00
|
|
|
|
{
|
2021-07-11 18:43:25 +08:00
|
|
|
|
<!-- When the node is not leaf, then show switcher icon -->
|
|
|
|
|
if (!SelfNode.IsLeaf)
|
2020-10-09 15:13:32 +08:00
|
|
|
|
{
|
2021-07-11 18:43:25 +08:00
|
|
|
|
@if (TreeComponent.SwitcherIconTemplate != null)
|
|
|
|
|
{
|
|
|
|
|
<span class="ant-tree-switcher-icon">
|
|
|
|
|
@TreeComponent.SwitcherIconTemplate(SelfNode)
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
else if (TreeComponent.SwitcherIcon != null)
|
|
|
|
|
{
|
|
|
|
|
<Icon Type="TreeComponent.SwitcherIcon" Class="ant-tree-switcher-icon" />
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<Icon Type="@(IsSwitcherOpen ? "minus-square" : "plus-square")" Class="ant-tree-switcher-line-icon" />
|
|
|
|
|
}
|
2020-10-09 15:13:32 +08:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-07-11 18:43:25 +08:00
|
|
|
|
<!-- Show the leaf icon (file) or leaf line (└) -->
|
|
|
|
|
if (TreeComponent.ShowLeafIcon)
|
|
|
|
|
{
|
|
|
|
|
<Icon Type="file" Theme="outline" Class="ant-tree-switcher-line-icon" />
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<span class="ant-tree-switcher-leaf-line"></span>
|
|
|
|
|
}
|
2020-10-09 15:13:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-07-11 18:43:25 +08:00
|
|
|
|
else if (!SelfNode.IsLeaf)
|
|
|
|
|
{
|
|
|
|
|
<!-- node is not leaf and not show line, then show the default arrow icon -->
|
|
|
|
|
<Icon Type="caret-down" Theme="outline" Class="ant-tree-switcher-icon" />
|
|
|
|
|
}
|
2020-10-09 15:13:32 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</span>
|