API Test
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Model;
|
||||
|
||||
namespace Shared.Services;
|
||||
|
||||
public class CardRenderingService
|
||||
{
|
||||
private readonly List<string> _allTerms;
|
||||
private readonly Dictionary<string, CardData> _cardLookup;
|
||||
private readonly Dictionary<string, DocData> _docLookup;
|
||||
private readonly List<string> _allTerms;
|
||||
private readonly Regex _termRegex;
|
||||
|
||||
public CardRenderingService()
|
||||
@@ -39,7 +40,8 @@ public class CardRenderingService
|
||||
_termRegex = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
}
|
||||
|
||||
public RenderFragment RenderDescription(string description, Action<CardData?> onCardClick, Action<DocData?>? onDocClick = null, CardPreviewService? previewService = null)
|
||||
public RenderFragment RenderDescription(string description, Action<CardData?> onCardClick,
|
||||
Action<DocData?>? onDocClick = null, CardPreviewService? previewService = null)
|
||||
{
|
||||
return builder =>
|
||||
{
|
||||
@@ -69,12 +71,13 @@ public class CardRenderingService
|
||||
{
|
||||
builder.AddAttribute(sequence++, "onclick",
|
||||
EventCallback.Factory.Create(this, () => onCardClick(card)));
|
||||
|
||||
|
||||
if (previewService != null)
|
||||
{
|
||||
builder.AddAttribute(sequence++, "onmouseenter",
|
||||
EventCallback.Factory.Create<Microsoft.AspNetCore.Components.Web.MouseEventArgs>(this, e => previewService.Show(card, e.ClientX, e.ClientY)));
|
||||
builder.AddAttribute(sequence++, "onmouseleave",
|
||||
builder.AddAttribute(sequence++, "onmouseenter",
|
||||
EventCallback.Factory.Create<MouseEventArgs>(this,
|
||||
e => previewService.Show(card, e.ClientX, e.ClientY)));
|
||||
builder.AddAttribute(sequence++, "onmouseleave",
|
||||
EventCallback.Factory.Create(this, () => previewService.Hide()));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user