Skip to content

AbstractInputSuggest

Attach to an <input> element or a <div contentEditable> to add type-ahead support.

Extends

Type Parameters

T

Constructors

new AbstractInputSuggest()

new AbstractInputSuggest<T>(app, textInputEl): AbstractInputSuggest<T>

Accepts an <input> text box or a contenteditable div.

Parameters

app: App

textInputEl: HTMLDivElement | HTMLInputElement

Returns

AbstractInputSuggest<T>

Overrides

PopoverSuggest.constructor

Properties

app

app: App

Inherited from

PopoverSuggest.app


isOpen

isOpen: boolean

Whether the suggestion popup is currently open and visible

Inherited from

PopoverSuggest.isOpen


limit

limit: number

Limit to the number of elements rendered at once. Set to 0 to disable. Defaults to 100.


scope

scope: Scope

Inherited from

PopoverSuggest.scope


suggestEl

suggestEl: HTMLElement

Suggestion container element

Inherited from

PopoverSuggest.suggestEl


suggestions

suggestions: SuggestionContainer<T>

Handles selection and rendering of the suggestions

Inherited from

PopoverSuggest.suggestions

Methods

close()

close(): void

Returns

void

Inherited from

PopoverSuggest.close


getSuggestions()

abstract getSuggestions(query): T[] | Promise<T[]>

Parameters

query: string

Returns

T[] | Promise<T[]>


getValue()

getValue(): string

Gets the value from the input element.

Returns

string


onSelect()

onSelect(callback): this

Registers a callback to handle when a suggestion is selected by the user.

Parameters

callback

Returns

this


open()

open(): void

Returns

void

Inherited from

PopoverSuggest.open


renderSuggestion()

abstract renderSuggestion(value, el): void

Render the suggestion item into DOM.

Parameters

value: T

el: HTMLElement

Returns

void

Inherited from

PopoverSuggest.renderSuggestion


selectSuggestion()

selectSuggestion(value, evt): void

Parameters

value: T

evt: MouseEvent | KeyboardEvent

Returns

void

Overrides

PopoverSuggest.selectSuggestion


setValue()

setValue(value): void

Sets the value into the input element.

Parameters

value: string

Returns

void