Options
All
  • Public
  • Public/Protected
  • All
Menu

Represents the user interface which binds to the DOM.

The View class is designed to be consumed by an Autocomplete.Controller instance and should not be accessed directly unless absolutely necessary.

The main function of the View is to:

  • Present suggestions supplied by the controller
  • Provide callbacks to the controller for various user interactions
  • Provide methods to manipulate the user interface if required

Hierarchy

  • View

Index

Constructors

constructor

  • Creates an View instance

    Parameters

    Returns View

Methods

attach

  • Adds View to DOM

    • Wraps input with container
    • Appends suggestion list to container
    • Enables listeners
    • Starts FSM

    Returns View

close

  • close(reason: CloseReason): View
  • Close address finder

    Parameters

    • reason: CloseReason

    Returns View

closed

  • closed(): boolean
  • Returs false if address finder is closed

    Returns boolean

createUnhide

  • createUnhide(): HTMLElement
  • Creates a clickable element that can trigger unhiding of fields

    Returns HTMLElement

current

  • current(): number
  • Index of currently highlighted suggestion

    Returns number

detach

  • Removes View from DOM

    • Disable listeners
    • Removes sugestion list from container
    • Appends suggestion list to container
    • Enables listeners
    • Stops FSM

    Returns View

hideFields

  • hideFields(): void
  • Hides fields marked for hiding

    Returns void

next

  • Sets next suggestion as current

    Returns View

open

  • Open address finder

    Returns View

opened

  • opened(): boolean
  • Returns true if address finder is open

    Returns boolean

previous

  • Sets previous suggestion as current

    Returns View

query

  • query(): string
  • Returns current address query

    Returns string

select

  • select(li?: Element): View
  • Trigger select event on an element or clicked HTMLElement

    Parameters

    • Optional li: Element

    Returns View

setMessage

  • setMessage(message: string): View
  • Sets message as a list item, no or empty string removes any message

    Parameters

    • message: string

    Returns View

setSuggestions

  • setSuggestions(suggestions: AddressSuggestion[], query: string): View
  • Set address finder suggestions

    Parameters

    • suggestions: AddressSuggestion[]
    • query: string

    Returns View

suggestions

  • suggestions(): AddressSuggestion[]
  • Current list of suggestions stored in view

    Returns AddressSuggestion[]

unhideFields

  • unhideFields(): void
  • Unhides fields marked for hiding

    Returns void

unmountUnhide

  • unmountUnhide(): void
  • Removes unhide elem from DOM

    Returns void