@namespace AntDesign
@inherits ComponentBase
@typeparam TItem
@using System.Text.RegularExpressions;
@if (CanDraggable)
{
@if (TreeComponent.TitleIconTemplate != null && TreeComponent.ShowIcon)
{
@TreeComponent.TitleIconTemplate(SelfNode)
}
else if (string.IsNullOrWhiteSpace(SelfNode.Icon) == false && TreeComponent.ShowIcon)
{
@if (string.IsNullOrWhiteSpace(SelfNode.Icon) == false)
{
}
}
@if (TreeComponent.TitleTemplate != null)
{
@TreeComponent.TitleTemplate(SelfNode)
}
else
{
@if (SelfNode.TitleTemplate != null)
{
@SelfNode.TitleTemplate
}
else
{
bool shouldMarkup = SelfNode.Matched && !string.IsNullOrWhiteSpace(TreeComponent.SearchValue);
int index = -1;
if (shouldMarkup)
{
index = SelfNode.Title.IndexOf(TreeComponent.SearchValue, StringComparison.InvariantCultureIgnoreCase);
}
if (shouldMarkup && (index > -1))
{
var start = SelfNode.Title.Substring(0, index);
var match = SelfNode.Title.Substring(index, TreeComponent.SearchValue.Length);
var end = SelfNode.Title.Substring(index + TreeComponent.SearchValue.Length);
var value = $"{start}{match}{end}";
@((MarkupString)value)
}
else
{
@SelfNode.Title
}
}
}
@if (SelfNode.DragTarget)
{
}
}
else
{
@if (TreeComponent.TitleIconTemplate != null && TreeComponent.ShowIcon)
{
@TreeComponent.TitleIconTemplate(SelfNode)
}
else if ((!string.IsNullOrWhiteSpace(SelfNode.Icon) || SelfNode.IconTemplate != null) && TreeComponent.ShowIcon)
{
@if (SelfNode.IconTemplate != null)
{
@SelfNode.IconTemplate(SelfNode)
}
else if (!string.IsNullOrWhiteSpace(SelfNode.Icon))
{
}
}
@if (TreeComponent.TitleTemplate != null)
{
@TreeComponent.TitleTemplate(SelfNode)
}
else if (SelfNode.TitleTemplate != null)
{
@SelfNode.TitleTemplate
}
else
{
@if (SelfNode.Matched && !string.IsNullOrWhiteSpace(TreeComponent.SearchValue))
{
int index = SelfNode.Title.IndexOf(TreeComponent.SearchValue, StringComparison.InvariantCultureIgnoreCase);
var start = SelfNode.Title.Substring(0, index);
var match = SelfNode.Title.Substring(index, TreeComponent.SearchValue.Length);
var end = SelfNode.Title.Substring(index + TreeComponent.SearchValue.Length);
var value = $"{start}{match}{end}";
@((MarkupString)value)
}
else
{
@SelfNode.Title
}
}
@if (SelfNode.DragTarget)
{
}
}