2020-05-19 22:34:09 +08:00
|
|
|
|
using Microsoft.AspNetCore.Components;
|
2020-05-29 00:33:49 +08:00
|
|
|
|
using AntDesign.Internal;
|
2020-05-21 12:21:22 +08:00
|
|
|
|
using OneOf;
|
|
|
|
|
using System.Threading.Tasks;
|
2020-05-19 22:34:09 +08:00
|
|
|
|
using System.Linq;
|
|
|
|
|
|
2020-05-29 00:33:49 +08:00
|
|
|
|
namespace AntDesign
|
2020-05-19 22:34:09 +08:00
|
|
|
|
{
|
|
|
|
|
public partial class Tooltip : OverlayTrigger
|
|
|
|
|
{
|
|
|
|
|
[Parameter]
|
2020-05-21 12:21:22 +08:00
|
|
|
|
public OneOf<string, RenderFragment> Title { get; set; } = string.Empty;
|
2020-05-19 22:34:09 +08:00
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public bool ArrowPointAtCenter { get; set; } = false;
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public double MouseEnterDelay { get; set; } = 0.1;
|
|
|
|
|
|
|
|
|
|
[Parameter]
|
|
|
|
|
public double MouseLeaveDelay { get; set; } = 0.1;
|
|
|
|
|
|
|
|
|
|
public Tooltip()
|
|
|
|
|
{
|
|
|
|
|
PrefixCls = "ant-tooltip";
|
2020-05-21 12:21:22 +08:00
|
|
|
|
Placement = PlacementType.Top;
|
2020-05-19 22:34:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string GetOverlayEnterClass()
|
|
|
|
|
{
|
2020-05-21 12:21:22 +08:00
|
|
|
|
return "zoom-big-fast-enter zoom-big-fast-enter-active zoom-big-fast";
|
2020-05-19 22:34:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
2020-05-21 12:21:22 +08:00
|
|
|
|
public override string GetOverlayLeaveClass()
|
2020-05-19 22:34:09 +08:00
|
|
|
|
{
|
2020-05-21 12:21:22 +08:00
|
|
|
|
return "zoom-big-fast-leave zoom-big-fast-leave-active zoom-big-fast";
|
2020-05-19 22:34:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override async Task Show(int? overlayLeft = null, int? overlayTop = null)
|
|
|
|
|
{
|
|
|
|
|
if (Trigger.Contains(TriggerType.Hover))
|
|
|
|
|
{
|
|
|
|
|
await Task.Delay((int)(MouseEnterDelay * 1000));
|
|
|
|
|
}
|
2020-05-21 12:21:22 +08:00
|
|
|
|
|
2020-05-19 22:34:09 +08:00
|
|
|
|
await base.Show(overlayLeft, overlayTop);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override async Task Hide(bool force = false)
|
|
|
|
|
{
|
|
|
|
|
if (Trigger.Contains(TriggerType.Hover))
|
|
|
|
|
{
|
|
|
|
|
await Task.Delay((int)(MouseLeaveDelay * 1000));
|
|
|
|
|
}
|
2020-05-21 12:21:22 +08:00
|
|
|
|
|
2020-05-19 22:34:09 +08:00
|
|
|
|
await base.Hide(force);
|
|
|
|
|
}
|
2020-05-21 12:21:22 +08:00
|
|
|
|
|
2020-05-19 22:34:09 +08:00
|
|
|
|
}
|
|
|
|
|
}
|