import { ElementRef, OnInit, DoCheck, IterableDiffers, EventEmitter } from '@angular/core';
import { CfCoreComponent } from '../core/core.component';
import { AutocompleteModel } from '../../models/autocomplete/autocomplete.model';
import { AutocompleteStylingModel } from '../../models/autocomplete/autocomplete-styling.model';
import { AutocompleteService } from '../../services/autocomplete-service/autocomplete.service';
import { TemplateService } from '../../services/template-service/template.service';
/**
*
CF Autocomplete Component
*
* import {{'{'}} AutocompleteModel {{'}'}} from 'cedrus-fusion'
* import {{'{'}} AutocompleteStylingModel {{'}'}} from 'cedrus-fusion'
* <cf-autocomplete [properties]="myAutocomplete" [styling]="myAutocompleteStyles">
* </cf-autocomplete>
*
*/
export declare class CfAutocompleteComponent extends CfCoreComponent implements OnInit, DoCheck {
elementRef: ElementRef;
autocompleteService: AutocompleteService;
/**
* Example of model:
* {{'{'}}
* displayField: "label",
* source: this.mySource,
* useChips: true,
* chipsSelected: "multiple",
* chipsReadOnly: false,
* multiselection: false,
* uniqueSelected: true,
* stayOpenedOnClick: true,
* highlighting: false,
* prefetch: true,
* cache: true,
* delay: 1000
*{{'}'}}
* List of all model properties
* displayField: string
* Name of item property to be used as item label and selected value. Required.
* source: any[]
* Array with items. Has lower priority then 'serverUrl'.
* serverUrl: string
* Server url to be called for to take items. Has highter priority then 'source'.
* useChips: boolean
* Using chips for selected items. Default: false.
* chipsSelected: string
* If useChips is true, then it is possible to set chips selection: single or multiple. Default: multiple.
* chipsReadOnly: boolean
* If chips can't be removed after selection. Default: false.
* multiselection: boolean
* If dropdown item can be selected multiple times. Default: true.
* uniqueSelected: boolean
* Search items with using comma inside search input field. Default: false.
* stayOpenedOnClick: boolean
* If dropdown must be opened on selecting items. Default: false.
* highlighting: boolean
* If to highlight search value in items labels. Default: false.
* cache: boolean
* If to cache search results. Default: false.
* prefetch: boolean
* If to send request to a server on component init. Default: false.
* delay: boolean
* The amount of time in milliseconds from when the user stops typing to when the result is returned. Default: 250.
*/
properties: AutocompleteModel;
/**
* Object for all styling properties
* container: StylingModel
* StylingModel for styling component container
* chipsContainer: StylingModel
* StylingModel for styling chips container
* chips: StylingModel
* StylingModel for styling chips item
* searchContainer: StylingModel
* StylingModel for styling search container with input and dropdown
* inputContainer: StylingModel
* StylingModel for styling input container
* input: StylingModel
* StylingModel for styling input element
* dropdownContainer: StylingModel
* StylingModel for styling dropdown container
* dropdownItem: StylingModel
* StylingModel for styling dropdown item
*/
styling: AutocompleteStylingModel;
/**
* Name of item property to be used as item label and selected value. Required.
*/
displayField: string;
/**
* Array with items. Has lower priority then 'serverUrl'.
*/
source: any[];
/**
* Server url to be called for to take items. Has highter priority then 'source'.
*/
serverUrl: string;
/**
* Using chips for selected items. Default: false.
*/
useChips: boolean;
/**
* If useChips is true, then it is possible to set chips selection: single or multiple. Default: multiple.
*/
chipsSelected: string;
/**
* If chips can't be removed after selection. Default: false.
*/
chipsReadOnly: boolean;
/**
* Search items with using comma inside search input field. Default: false.
*/
multiselection: boolean;
/**
* If dropdown item can be selected multiple times. Default: true.
*/
uniqueSelected: boolean;
/**
* If dropdown must be opened on selecting items. Default: false.
*/
stayOpenedOnClick: boolean;
/**
* If to highlight search value in items labels. Default: false.
*/
highlighting: boolean;
/**
* To cache search results. Default: false.
*/
cache: boolean;
/**
* If to send request to a server on component init. Default: false.
*/
prefetch: boolean;
/**
* The amount of time in milliseconds from when the user stops typing to when the result is returned. Default: 250.
*/
delay: boolean;
/**
* It is output event, which send search value.
*/
onSearch: EventEmitter;
/**
* It is output event, which send array with selected item/items.
*/
onSelect: EventEmitter;
/** @hidden
* User template for items in dropdown
*/
dropdownItemTemplate: any;
/** @hidden
* User template for selected chips
*/
selectedItemTemplate: any;
/** @hidden
* Array for default init items from user or server
*/
itemsToBeFiltered: any[];
/** @hidden
* Temprorary array with filtered items during filtering execution and after to be passed to filteredItems
*/
tempFiltered: any[];
/** @hidden
* Array with filtered items which is using inside dropdown in html
*/
filteredItems: any[];
/** @hidden
* Means if user focused search input field or is working with opened dropdown list items
*/
inputIsFocused: boolean;
/** @hidden
* This is state of autocomplete to check from where search value was changed
*/
selectedByUser: boolean;
/** @hidden
* This is autocomplete search value
*/
searchValue: string;
/** @hidden
* It is array with selected items as chips
*/
selectedItems: any[];
/** @hidden
* It is array with selected items as multiselection by comma inside search input
*/
selection: any[];
/** @hidden
* Means selected items as labels inside search input separated by comma
*/
multipleSelected: string;
/** @hidden
* If search value was changed by user
*/
typedByUser: boolean;
/** @hidden
* Cache for search results
*/
cached: any;
/** @hidden
* Timeout for user typing
*/
typingTimer: any;
/**@hidden
* Object to register element state and compute differences.
*/
differ: any;
/**@hidden
* Method to resolve to show dropdown items list
*/
private readonly _resolveList;
/** @hidden
* Constructor to upgrade component and register click events to close dropdown if needed
*/
constructor(elementRef: ElementRef,
/**@hidden */ templateService: TemplateService, autocompleteService: AutocompleteService, differs: IterableDiffers);
/** @hidden
* Initializing component data
*/
ngOnInit(): void;
/**
* @hidden
* Checking changes in component properties
*/
ngDoCheck(): void;
/** @hidden
* Function to show all items
*/
showAllItems(): void;
/** @hidden
* Function to check if to close dropdown
* @param e click event object
*/
checkIfToCloseDropdown(e: any): void;
/** @hidden
* Function to start searching mechanism
*/
searchFocused(): void;
/** @hidden
* Function to set filtering system parameters
* @param inputValue string value by which items will be filtered
* @param userTyped boolean value means if search value was changed by user typing
*/
search(inputValue: string, userTyped: boolean): void;
/** @hidden
* Function run filtering system
* @param term string value by which items will be filtered this.filteredItems
*/
filterItems(term: string): void;
/** @hidden
* Function for multiselection filtering
* @param term string value by which items will be filtered
*/
checkDelimited(term: string): void;
/** @hidden
* Function for highlighting search value in items labels
* @param label item label
*/
highlight(label: string): string;
/** @hidden
* Function for return true/false if item can be selected
* @param item item json object
*/
checkIfSelected(item: any): boolean;
/** @hidden
* Function for selecting items in dropdown list
* @param item item json object
*/
selectItem(item: any): void;
/** @hidden
* Function for deleting items from chips array
* @param item item json object
* @param i item index in chips array
*/
removeSelectedItem(item: any, i: number): void;
/** @hidden
* Function to check if search value match in previous search requests
* @param value search text to be sent as request param
*/
checkInCache(value: any): boolean;
/** @hidden
* Function to compare two objects for equality
* @param obj1 object
* @param obj2 object
*/
compare(obj1: any, obj2: any): boolean;
/** @hidden
* Function to merge all cached results into main working array: itemsToBeFiltered
* @param value name of array in cahced object
*/
mergeCached(value: any): void;
/** @hidden
* Function to call AutocompleteService function to make request to remote server
* @param value search text to be sent as request param
*/
takeData(value: string): void;
}