UNPKG

ontotext-reusable-ui-components

Version:

Unified reusable UI components designed for the Ontotext ecosystem.

53 lines (52 loc) 2.17 kB
import { EventEmitter, OnInit, TemplateRef } from '@angular/core'; import { Observable } from 'rxjs'; import { SearchFieldModel } from './models/search-field-model'; export declare class OntoSearchFieldComponent implements OnInit { /** * Custom template reference. Will override the template used in autocomplete dropdown. * When creating the custom template, a variable must be declared in order to access the object and its properties. * The variable holds the index number of the element in it's index parameter, and the element in it's state parameter. * * For example, if you name you variable item: * <ng-template #customTemplate let-item> * <span [attr.appCypressData]="'custom-state-label-' + item.index" class="state-label">{{item.state.label}}</span> * </ng-template> */ customTemplate?: TemplateRef<any>; /** * Preselected states list. */ selectedList: any[]; /** * Observable of data that is provides autocomplete options */ private autocompleteData; /** * If the results for the autocomplete are obtained at once and the component is responsible for filtering them, * then the true must be set. * By default is set to false assuming every key press sends a request for a new list of autocomplete results. */ enableInnerAutocompleteFiltration: boolean; /** * A custom function that applies to each of the selected search objects, which is not free text. * The function is applied to the selected search phrases when Search button is pressed. * * If not specified, the component returns the selected object unmodified. * * Example: * this.searchResultMappingFunction = (data) => data.label; */ searchResultMappingFunction: (args: SearchFieldModel) => any; /** * Emits selected search phrases on search button press. */ onSearch: EventEmitter<any>; /** * On key press event emitter. */ onKeyPress: EventEmitter<any>; states: Observable<SearchFieldModel[]>; ngOnInit(): void; onSearchEvent($event: any): void; onKeyPressEvent($event: any): void; }