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
|
2021-07-11 18:43:25 +08:00
|
|
|
|
@if (CanDraggable)
|
|
|
|
|
{
|
|
|
|
|
<span class="@TitleClassMapper.Class" title="@SelfNode.Title" @onclick="OnClick" @ondblclick="OnDblClick" draggable="true"
|
|
|
|
|
@ondragover:preventDefault @ondragover="OnDragOver" @ondragleave="OnDragLeave" @ondragenter="OnDragEnter" @ondrop:preventDefault @ondrop="OnDrop"
|
|
|
|
|
@ondragstart="OnDragStart" @ondragend="OnDragEnd" aria-grabbed="true">
|
|
|
|
|
@if (TreeComponent.TitleIconTemplate != null && TreeComponent.ShowIcon)
|
|
|
|
|
{
|
|
|
|
|
<span class="ant-tree-iconEle @(IsSwitcherOpen?"ant-tree-icon__open":"") @(IsSwitcherClose?"ant-tree-icon__close":"") @(SelfNode.Loading?"ant-tree-icon_loading":"")">
|
|
|
|
|
<span class="ant-tree-iconEle ant-tree-icon__customize">
|
|
|
|
|
@TreeComponent.TitleIconTemplate(SelfNode)
|
|
|
|
|
</span>
|
2020-10-09 15:13:32 +08:00
|
|
|
|
</span>
|
2021-07-11 18:43:25 +08:00
|
|
|
|
}
|
|
|
|
|
else if (string.IsNullOrWhiteSpace(SelfNode.Icon) == false && TreeComponent.ShowIcon)
|
|
|
|
|
{
|
|
|
|
|
<span class="ant-tree-iconEle @(IsSwitcherOpen?"ant-tree-icon__open":"") @(IsSwitcherClose?"ant-tree-icon__close":"") @(SelfNode.Loading?"ant-tree-icon_loading":"")">
|
|
|
|
|
<span class="ant-tree-iconEle ant-tree-icon__customize">
|
|
|
|
|
@if (string.IsNullOrWhiteSpace(SelfNode.Icon) == false)
|
|
|
|
|
{
|
|
|
|
|
<Icon Type="@SelfNode.Icon" Theme="outline" />
|
|
|
|
|
}
|
|
|
|
|
</span>
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
@if (TreeComponent.TitleTemplate != null)
|
|
|
|
|
{
|
|
|
|
|
@TreeComponent.TitleTemplate(SelfNode)
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<span class="ant-tree-title" style="pointer-events: none;">
|
|
|
|
|
@if (SelfNode.TitleTemplate != null)
|
|
|
|
|
{
|
|
|
|
|
@SelfNode.TitleTemplate
|
|
|
|
|
}
|
|
|
|
|
else if (SelfNode.Matched)
|
|
|
|
|
{
|
|
|
|
|
var value = $"<span Style=\"{TreeComponent.MatchedStyle}\">{TreeComponent.SearchValue}</span>";
|
|
|
|
|
<span>
|
|
|
|
|
@((MarkupString)SelfNode.Title.Replace(TreeComponent.SearchValue, value))
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
@SelfNode.Title
|
|
|
|
|
}
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
@if (SelfNode.DragTarget)
|
|
|
|
|
{
|
|
|
|
|
<div class="ant-tree-drop-indicator" style="left:@(SelfNode.DragTargetBottom?"4px":"28px");right:0;bottom:-3px;"></div>
|
|
|
|
|
}
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<span class="@TitleClassMapper.Class" title="@SelfNode.Title" @onclick="OnClick" @ondblclick="OnDblClick">
|
|
|
|
|
@if (TreeComponent.TitleIconTemplate != null && TreeComponent.ShowIcon)
|
|
|
|
|
{
|
|
|
|
|
<span class="ant-tree-iconEle @(IsSwitcherOpen?"ant-tree-icon__open":"") @(IsSwitcherClose?"ant-tree-icon__close":"") @(SelfNode.Loading?"ant-tree-icon_loading":"")">
|
|
|
|
|
<span class="ant-tree-iconEle ant-tree-icon__customize">
|
|
|
|
|
@TreeComponent.TitleIconTemplate(SelfNode)
|
|
|
|
|
</span>
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
else if ((!string.IsNullOrWhiteSpace(SelfNode.Icon) || SelfNode.IconTemplate != null) && TreeComponent.ShowIcon)
|
|
|
|
|
{
|
|
|
|
|
<span class="ant-tree-iconEle @(IsSwitcherOpen?"ant-tree-icon__open":"") @(IsSwitcherClose?"ant-tree-icon__close":"") @(SelfNode.Loading?"ant-tree-icon_loading":"")">
|
|
|
|
|
<span class="ant-tree-iconEle ant-tree-icon__customize">
|
|
|
|
|
@if (SelfNode.IconTemplate != null)
|
|
|
|
|
{
|
|
|
|
|
@SelfNode.IconTemplate(SelfNode)
|
|
|
|
|
}
|
|
|
|
|
else if (!string.IsNullOrWhiteSpace(SelfNode.Icon))
|
|
|
|
|
{
|
|
|
|
|
<Icon Type="@SelfNode.Icon" Theme="outline" />
|
|
|
|
|
}
|
|
|
|
|
</span>
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
@if (TreeComponent.TitleTemplate != null)
|
|
|
|
|
{
|
|
|
|
|
@TreeComponent.TitleTemplate(SelfNode)
|
|
|
|
|
}
|
|
|
|
|
else if (SelfNode.TitleTemplate != null)
|
|
|
|
|
{
|
|
|
|
|
@SelfNode.TitleTemplate
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<span class="ant-tree-title">
|
|
|
|
|
@if (SelfNode.Matched)
|
|
|
|
|
{
|
|
|
|
|
var value = $"<span Style=\"{TreeComponent.MatchedStyle}\">{TreeComponent.SearchValue}</span>";
|
|
|
|
|
<span>
|
|
|
|
|
@((MarkupString)SelfNode.Title.Replace(TreeComponent.SearchValue, value))
|
|
|
|
|
</span>
|
|
|
|
|
}
|
|
|
|
|
else
|
2020-10-09 15:13:32 +08:00
|
|
|
|
{
|
2021-07-11 18:43:25 +08:00
|
|
|
|
@SelfNode.Title
|
2020-10-09 15:13:32 +08:00
|
|
|
|
}
|
|
|
|
|
</span>
|
2021-07-11 18:43:25 +08:00
|
|
|
|
}
|
|
|
|
|
@if (SelfNode.DragTarget)
|
|
|
|
|
{
|
|
|
|
|
<div class="ant-tree-drop-indicator" style="left:@(SelfNode.DragTargetBottom?"4px":"28px");right:0;bottom:-3px;"></div>
|
|
|
|
|
}
|
|
|
|
|
</span>
|
|
|
|
|
}
|