Adapter that handles ordinary URL lookup (as specified in AbstractLookupAdapter) and autocomplete searches. Autocomplete searches rely on the remote-ac package written by Danqing Liu.

The autocomplete class (AC global) must exist before this code is run. We communicate with the widget using callbacks, prefixed with _, which are bound to it.

Hierarchy (View Summary)

Constructors

Properties

ac?: default<any>

After AbstractAutocompleteAdapter#setupAutocomplete is run, holds a reference to the autocomplete widget used by this instance.

acCSSPrefix: string = 'ac-adapter-'

CSS prefix for the autocomplete widget.

acDelay: number = 300

Delay in milliseconds before performing a search.

acPrimaryTextKey: string = 'label'

Key (into the row objects retrieved via the request handler) that determines which value is used as the main text in the autocomplete widget.

'label' corresponds to what the main application expects, but if you want to show something different than what gets passed to the application, you may want to change it.

acSecondaryTextKey: string = 'description'

Default row key for the optional secondary, smaller text shown in the autocomplete widget below each result.

searchBoxSelector: string
sourceID?: string

Canonical identifier for this source. Lower-case string, no whitespace.

supportedPattern?: RegExp

RegExp for URLs this adapter can handle.

updateCallback: Function | UpdateCallback

Callback to run after a successful lookup

Methods

  • Pass along row data we can handle to the main application. Will also query lib.reviews itself (through the native adapter) for the URL, so we can give preferential treatment to an existing native record for the review subject.

    Parameters

    • row: { description?: string; label?: string; subtitle?: string; url?: string }

      row data object. All properties except "url" are only used for display purposes, since the server performs its own lookup on the URL.

    • event: Event

      the click or keyboard event which triggered this row selection.

    Returns void

  • Initialize the autocomplete widget. You can add additional callbacks / custom properties in the inherited class; just remember to call super.setupAutocomplete() first.

    Returns void