Options
All
  • Public
  • Public/Protected
  • All
Menu

The Search component displays a menu of as-you-type results from a variety of sources.

The search box will be 'activated' if the app's search state's getInitialSearch() value is a truthy value. If this is the case, an 'x' button will be shown next to the search field, and clicking it will clear the search.

ATTRS:

  • state: SearchState instance.

Type parameters

Hierarchy

Index

Constructors

constructor

Properties

Protected attrs

attrs: T

The attributes passed into the component.

see

https://mithril.js.org/components.html#passing-data-to-components

Protected element

element: Element

The root DOM element for the component.

Protected hasFocus

hasFocus: boolean = false

Whether or not the search input has focus.

Protected index

index: number = 0

The index of the currently-selected

  • in the results list. This can be a unique string (to account for the fact that an item's position may jump around as new results load), but otherwise it will be numeric (the sequential position within the list).

  • Protected loadingSources

    loadingSources: number = 0

    The number of sources that are still loading results.

    Protected navigator

    Protected searchState

    searchState: SearchState

    The instance of SearchState for this component.

    Protected Optional searchTimeout

    searchTimeout?: Timeout

    Protected Optional sources

    sources?: SearchSource[]

    An array of SearchSources.

    Private Optional updateMaxHeightHandler

    updateMaxHeightHandler?: () => void

    Type declaration

      • (): void
      • Returns void

    Static Protected MIN_SEARCH_LEN

    MIN_SEARCH_LEN: number = 3

    The minimum query length before sources are searched.

    Accessors

    Protected state

    Methods

    Protected $

    • Returns a jQuery object for this component's element. If you pass in a selector string, this method will return a jQuery object, using the current element as its buffer.

      For example, calling component.$('li') will return a jQuery object containing all of the li elements inside the DOM element of this component.

      final

      Parameters

      • Optional selector: string

      Returns JQuery<HTMLElement>

      the jQuery object for the DOM node

    clear

    • clear(): void

    getCurrentNumericIndex

    • getCurrentNumericIndex(): number

    getItem

    Parameters

    Returns JQuery<HTMLElement>

    onbeforeremove

    onbeforeupdate

    oncreate

    oninit

    onremove

    onupdate

    selectResult

    selectableItems

    setIndex

    sourceItems

    updateMaxHeight

    view

    Static component

    Static Protected initAttrs

    Generated using TypeDoc version 0.22.10