# Common Autocomplete

This component will handle a lot of the boilerplate and quirks that we (BRG) have run into while trying to implement an autocomplete solution.

## Inputs

**control**: The form control associated with the component.

**lookupService**: The service that will request when a change is registered.

**data**: A list of data to populate the autocomplete dropdown. If provided the service will be ignored for everything except displaying a loading spinner.

**name**: A name used to identify the field, currently used for the FieldPlusDirective

**config**: A list of config options for the input and autocomplete
* **label**: The input label, also used to populate the validation messages
* **required**: Field is required, doesn't handle the validation just the display
* **requireSelection**: Whether an option must be selected or if free text entry is allowed
* **autoFocus**: Automatically focus on the input when it appears
* **inputOnly**: Disabled the autocomplete dropdown
* **triggerDisplay**: How the selected option displays in the input. Otherwise uses the *lookupValue*.
* **lookupDefaultFilter**: The default filter for *lookupService* requests. A FilterData[] object.
* **lookupDefaultSort**: The default sort for *lookupService* requests. A SortData[] object.
* **localLookupFields**: What fields to check in the provided *data* list when doing local filtering.
* **lookupStyle**: Lambda that accepts a *DataModel* object to determine a custom style.
* **lookupValue**: Primary value when selecting from autocomplete dropdown.
* **lookupSecondaryValue**: Value to give more context into the *lookupValue*, usually a description.
* **lookupSmallValue**: Value to display in smaller text below the *lookupSecondaryValue* to give additional context.
* **lookupSmallText**: Text to display next to the *lookupSmallValue* to give it additional context.

## Outputs

**beforeChange**: Fires immediately after input is typed into with a distinct value. Provides the value that was typed in.

**onChange**: Fires after input has registered a change (500 milliseconds). Provides the value that was typed in.

**onSelect**: Fires when an option is selected from the autocomplete dropdown. Provides the selected *DataModel*.

**onBlur**: Fires when the input is navigated away from. Provides the *FocusEvent*.
