@engie-group/fluid-design-system
Version:
The Fluid Design System is ENGIE’s open-source library to create, build and deliver ENGIE digital services in a more efficient way.
42 lines (41 loc) • 1.38 kB
TypeScript
/**
* --------------------------------------------------------------------------
* NJ: autocomplete.ts
* --------------------------------------------------------------------------
*/
import AbstractComponent from '../../globals/ts/abstract-component';
export interface AutocompleteItem {
name: string;
value: string;
}
export default class Autocomplete extends AbstractComponent {
static readonly NAME = "nj-form-autocomplete";
protected static readonly DATA_KEY = "nj.autocomplete";
static readonly SELECTOR: {
default: string;
input: string;
list: string;
listGroup: string;
};
private dataList;
private currentList;
options: {
autocomplete: boolean;
limit: number | boolean;
};
onUserSelectItem: (item: AutocompleteItem) => void;
private readonly listFragment;
private readonly root;
constructor(element: HTMLElement, options?: {});
static init(options?: {}): Autocomplete[];
dispose(): void;
set data(data: Array<AutocompleteItem>);
get data(): Array<AutocompleteItem>;
get list(): Array<AutocompleteItem>;
set list(data: Array<AutocompleteItem>);
private static compareText;
onInputChange: () => void;
onKeyDown: (e: any) => void;
onSelectListItem: (e: any) => void;
static getInstance(element: HTMLElement): Autocomplete;
}