2019-12-11 15:51:03 +01:00
|
|
|
import { TemplateRef } from '@angular/core';
|
2018-07-24 13:19:52 +02:00
|
|
|
import { Observable } from 'rxjs';
|
2019-01-18 18:03:45 +01:00
|
|
|
import { AutoCompleteGroup } from '../auto-complete-group';
|
2018-07-24 13:19:52 +02:00
|
|
|
|
|
|
|
export interface SingleAutoCompleteConfiguration {
|
|
|
|
// Delay for performing the request. Default: 200ms.
|
|
|
|
requestDelay?: number;
|
2019-01-18 18:03:45 +01:00
|
|
|
// Min characters for the filtering to be applied. Default: 1.
|
2018-07-24 13:19:52 +02:00
|
|
|
minFilteringChars?: number;
|
|
|
|
// Load and present items from start, without user query. Default: true.
|
|
|
|
loadDataOnStart?: boolean;
|
|
|
|
// Static or initial items.
|
2019-02-01 09:29:00 +01:00
|
|
|
initialItems?: (data?: any) => Observable<any[]>;
|
2018-07-24 13:19:52 +02:00
|
|
|
// Data retrieval function
|
2019-02-01 09:29:00 +01:00
|
|
|
filterFn?: (searchQuery: string, data?: any) => Observable<any[]>;
|
2019-12-11 15:51:03 +01:00
|
|
|
// Get selected items. Used when valueAssign is used so the full object can be retrieved for presentation.
|
|
|
|
getSelectedItem?: (selectedItem: any) => Observable<any>;
|
2018-07-24 13:19:52 +02:00
|
|
|
// Property formating for input
|
|
|
|
displayFn?: (item: any) => string;
|
2019-12-11 15:51:03 +01:00
|
|
|
// Function to group results in the drop down
|
2019-01-18 18:03:45 +01:00
|
|
|
groupingFn?: (items: any[]) => AutoCompleteGroup[];
|
2019-12-11 15:51:03 +01:00
|
|
|
// Display function for the drop down title
|
2018-07-24 13:19:52 +02:00
|
|
|
titleFn?: (item: any) => string;
|
2019-12-11 15:51:03 +01:00
|
|
|
// Display function for the drop down subtitle
|
2018-07-24 13:19:52 +02:00
|
|
|
subtitleFn?: (item: any) => string;
|
2019-01-18 18:03:45 +01:00
|
|
|
//Extra data passed to query function
|
|
|
|
extraData?: any;
|
2019-02-01 09:29:00 +01:00
|
|
|
// Callback to intercept value assignment based on item selection
|
|
|
|
valueAssign?: (selectedItem: any) => any;
|
2019-12-11 15:51:03 +01:00
|
|
|
// Property formating template
|
|
|
|
optionTemplate?: TemplateRef<any>;
|
|
|
|
// Selected value formating template
|
|
|
|
selectedValueTemplate?: TemplateRef<any>;
|
|
|
|
|
2020-11-25 13:22:30 +01:00
|
|
|
// To revert: "We set the items observable on focus to avoid the request being executed on component load."
|
|
|
|
forceFocus?: boolean;
|
2019-12-11 15:51:03 +01:00
|
|
|
|
|
|
|
autoSelectFirstOptionOnBlur?: boolean;
|
2018-07-24 13:19:52 +02:00
|
|
|
}
|