@muzykantov/ngx-dadata
Version:
Angular 6+ [DaData][dadata] suggestion (подсказки) implementation
67 lines (66 loc) • 2.1 kB
TypeScript
import { ElementRef, EventEmitter, OnChanges, OnInit, Renderer2, SimpleChanges } from '@angular/core';
import { DaDataType, NgxDaDataService } from "./ngx-da-data.service";
import { DaDataSuggestion } from "./models/suggestion";
import { DaDataConfig } from "./da-data-config";
import { ControlValueAccessor, FormControl } from "@angular/forms";
export declare function createDaDataValidator(value: any): (c: FormControl) => {
rangeError: {
given: any;
expected: any;
};
};
export declare class NgxDaDataComponent implements OnInit, ControlValueAccessor, OnChanges {
private dataService;
private _r;
private _value;
currentFocus: number;
data: DaDataSuggestion[];
config: DaDataConfig;
apiKey: string;
disabled: any;
type: DaDataType;
options: any;
limit: number;
placeholder: string;
selectedSuggestion: DaDataSuggestion;
selected: EventEmitter<DaDataSuggestion>;
input: EventEmitter<any>;
inputValue: ElementRef;
private inputString$;
onTouched: () => void;
propagateChange: any;
validateFn: any;
constructor(dataService: NgxDaDataService, _r: Renderer2);
value: any;
ngOnInit(): void;
ngOnChanges(changes: SimpleChanges): void;
getData(value: string): void;
onClick(e: MouseEvent, item: DaDataSuggestion): void;
onOutsideClick(): void;
onArrowDown(): void;
onArrowUp(): void;
onEnter(): void;
setFocus(id: number): void;
removeFocus(id: number): void;
writeValue(value: any): void;
/**
* Set the function to be called
* when the control receives a change event.
*
* @param fn a function
*/
registerOnChange(fn: any): void;
/**
* Set the function to be called
* when the control receives a touch event.
*
* @param fn a function
*/
registerOnTouched(fn: any): void;
/**
* Implements disabled state for this element
*
* @param isDisabled
*/
setDisabledState(isDisabled: boolean): void;
}