Class Sealed
public sealed class MokaJsonSearchOverlay : ComponentBase

Namespace: Moka.Blazor.Json.Components

Search/find panel with text input, match navigation, and mode toggles.

Inheritance

Inherits from: ComponentBase

Properties

NameDescription
ActiveMatchIndex Zero-based index of the active match.
CaseSensitive Whether case-sensitive search is active.
IsPending Whether the results are out of date because a search for the current query hasn't finished.
IsTruncated Whether the search stopped at its match limit, so there may be more matches than shown.
MatchCount Total number of matches found.
OnCaseSensitiveChanged Callback when case sensitivity is toggled.
OnClose Callback to close the search overlay.
OnNext Callback to navigate to the next match.
OnPrevious Callback to navigate to the previous match.
OnQueryChanged Callback when the query text changes.
OnRegexChanged Callback when regex mode is toggled.
ProgressPercent How far a running search has got, or -1 if it isn't known.
Query The current search query.
UseRegex Whether regex mode is active.

ActiveMatchIndex

[Parameter]
public int ActiveMatchIndex { get; set; }

Zero-based index of the active match.

CaseSensitive

[Parameter]
public bool CaseSensitive { get; set; }

Whether case-sensitive search is active.

IsPending

[Parameter]
public bool IsPending { get; set; }

Whether the results are out of date because a search for the current query hasn't finished.

IsTruncated

[Parameter]
public bool IsTruncated { get; set; }

Whether the search stopped at its match limit, so there may be more matches than shown.

MatchCount

[Parameter]
public int MatchCount { get; set; }

Total number of matches found.

OnCaseSensitiveChanged

[Parameter]
public EventCallback<bool> OnCaseSensitiveChanged { get; set; }

Callback when case sensitivity is toggled.

OnClose

[Parameter]
public EventCallback OnClose { get; set; }

Callback to close the search overlay.

OnNext

[Parameter]
public EventCallback OnNext { get; set; }

Callback to navigate to the next match.

OnPrevious

[Parameter]
public EventCallback OnPrevious { get; set; }

Callback to navigate to the previous match.

OnQueryChanged

[Parameter]
public EventCallback<string> OnQueryChanged { get; set; }

Callback when the query text changes.

OnRegexChanged

[Parameter]
public EventCallback<bool> OnRegexChanged { get; set; }

Callback when regex mode is toggled.

ProgressPercent

[Parameter]
public int ProgressPercent { get; set; }

How far a running search has got, or -1 if it isn't known.

Query

[Parameter]
public string? Query { get; set; }

The current search query.

UseRegex

[Parameter]
public bool UseRegex { get; set; }

Whether regex mode is active.

Methods

NameDescription
FocusAsync() Focuses the search input and selects its text.
OnAfterRenderAsync(bool firstRender) override

FocusAsync()

public Task FocusAsync()

Focuses the search input and selects its text.

Type Relationships
classDiagram
    style MokaJsonSearchOverlay fill:#f9f,stroke:#333,stroke-width:2px
    MokaJsonSearchOverlay --|> ComponentBase : inherits
View Source
/// <summary>
///     Search/find panel with text input, match navigation, and mode toggles.
/// </summary>
public sealed partial class MokaJsonSearchOverlay : ComponentBase
{
#region Injected Services
#endregion
#region Public API
    /// <summary>
    ///     Focuses the search input and selects its text.
    /// </summary>
    public async Task FocusAsync()
    {
        try
        {
            await Interop.FocusAndSelectInputAsync(InputId);
        }
        catch (Exception ex)when (ex is JSDisconnectedException or ObjectDisposedException or TaskCanceledException)
        {
        }
    }

#endregion
#region Lifecycle
    /// <inheritdoc/>
    protected override async Task OnAfterRenderAsync(bool firstRender)
    {
        if (firstRender)
        {
            await FocusAsync();
        }
    }

#endregion
#region Parameters
    /// <summary>The current search query.</summary>
    [Parameter]
    public string? Query { get; set; }

    /// <summary>Total number of matches found.</summary>
    [Parameter]
    public int MatchCount { get; set; }

    /// <summary>Zero-based index of the active match.</summary>
    [Parameter]
    public int ActiveMatchIndex { get; set; }

    /// <summary>Whether the results are out of date because a search for the current query hasn't finished.</summary>
    [Parameter]
    public bool IsPending { get; set; }

    /// <summary>
    ///     How far a running search has got, or -1 if it isn't known.
    /// </summary>
    [Parameter]
    public int ProgressPercent { get; set; } = -1;

    /// <summary>
    ///     Whether the search stopped at its match limit, so there may be more matches than shown.
    /// </summary>
    [Parameter]
    public bool IsTruncated { get; set; }

    /// <summary>Whether case-sensitive search is active.</summary>
    [Parameter]
    public bool CaseSensitive { get; set; }

    /// <summary>Whether regex mode is active.</summary>
    [Parameter]
    public bool UseRegex { get; set; }

    /// <summary>Callback when the query text changes.</summary>
    [Parameter]
    public EventCallback<string> OnQueryChanged { get; set; }

    /// <summary>Callback to navigate to the next match.</summary>
    [Parameter]
    public EventCallback OnNext { get; set; }

    /// <summary>Callback to navigate to the previous match.</summary>
    [Parameter]
    public EventCallback OnPrevious { get; set; }

    /// <summary>Callback to close the search overlay.</summary>
    [Parameter]
    public EventCallback OnClose { get; set; }

    /// <summary>Callback when case sensitivity is toggled.</summary>
    [Parameter]
    public EventCallback<bool> OnCaseSensitiveChanged { get; set; }

    /// <summary>Callback when regex mode is toggled.</summary>
    [Parameter]
    public EventCallback<bool> OnRegexChanged { get; set; }
#endregion
#region Event Handlers
#endregion
}
Was this page helpful?