import { OnChanges, ElementRef, QueryList, OnDestroy, NgZone } from "@angular/core"; import { ControlValueAccessor } from "@angular/forms"; export interface DropdownPlaceholders { searchText?: string; selectAllOptionText?: string; selectAllText?: string; emptyText?: string; noResultText?: string; } /** * A dropdown allows the user to select an option from a list. * Dropdowns enables users to make a quick selection of the available options for a specific entry. */ export declare class DropdownComponent implements ControlValueAccessor, OnChanges, OnDestroy { private _ngZone; static selectedDisplayLength: number; /** Element name */ name: string; /** List of dropdown items */ list: Array; /** Element ID */ id?: string; /** Element label */ label?: string; /** Error message of element */ error?: string; /** Element placeholder */ placeholder?: string; /** Element class */ className?: string; /** Property sets whether dropdown is disabled */ disabled?: boolean; /** Property sets whether native dropdown is rendered */ native?: boolean; /** Property sets whether user can select multiple items in the dropdown */ multi?: boolean; /** Property sets whether dropdown is clearable */ clearable?: boolean; /** Property sets whether dropdown is searchable */ searchable?: boolean; /** Set custom placeholders for dropdown field */ placeholders?: DropdownPlaceholders; /** On native change callback */ nativeOnChange?: (event: DropdownItem | Array | UIEvent) => void; /** Property sets whether dropdown is in ellipsis mode */ ellipsisMode: boolean; block?: boolean; get styles(): string; private onTouchedCallback; private onChangeCallback; private _subscriber; private _open; private _searchText; private _shouldFocus; private _currentFocused; private _selectedValue; allSelected: boolean; set searchText(state: string); get searchText(): string; set open(state: boolean); get open(): boolean; set shouldFocus(state: boolean); get shouldFocus(): boolean; set currentFocused(state: number); get currentFocused(): number; set selectedValue(state: DropdownItem | Array); get selectedValue(): DropdownItem | Array; /** array of dropdown item elements with a unique id, the original optionItem and calculated selected property */ uniqueList: Array; /** Array of dropdown item elements which should be displayed in the current render cycle */ displayList: Array; /** Array of all dropdown item which are currently selected */ selectedList: Array; toggleButtonId: string; dropdownToggleRef: ElementRef; dropdownMenuRef: ElementRef; searchRef: ElementRef; listRefs: QueryList; getRandomId(): string; handleFocus(): void; focusCurrentItem(): boolean; setInitialFocus(): void; constructor(_ngZone: NgZone); ngOnChanges(): void; ngOnDestroy(): void; /** internal generate helper array function. Should be run on every change where the helper arrays need to be regenerated */ private _generateHelperArrays; /** The native event function that runs when a keyboard button is pressed on dropdown toggle */ handleKeyDownToggle(event: KeyboardEvent): void; /** The native event function that runs when a keyboard button is pressed on dropdown menu */ handleKeyDownMenu(event: KeyboardEvent): void; /** The native event function that runs when the clean icon is clicked */ handleClickClear(event: MouseEvent): void; /** Function which handles the logic of setting the native onChange prop (and sets the internal selected value as well) */ handleNativeOnChange(event: UIEvent): void; /** Function which handles the logic of setting the non-native onChange prop (and sets the internal selected value as well) */ handleOnChange(value: DropdownItem | Array): void; /** Function containing the clear button logic */ handleClear(): void; /** The native onchange event function that runs when the search input value changes */ handleOnChangeSearch(event: KeyboardEvent): void; /** Function containing the select dropdown item logic */ optionItemSelected(item: DropdownItem): void; /** The native event function that runs when the dropdown button is clicked */ handleClickToggle(): void; /** Function containing the select all button logic */ handleSelectAll(): void; /** Returns the appropriate title for different situations and component types */ getTitleLabel(): string; handleItemOnMouseMove(index: number): void; handleItemOnClick(event: MouseEvent, index: number, item: DisplayItem): void; writeValue(value: any): void; registerOnChange(fn: any): void; registerOnTouched(fn: any): void; } export interface DropdownItem { /** The label or text to be displayed in the list */ label: string; /** A text to be displayed when the item is selected, ideally, a shorthand of the label */ shorthand?: string; /** Any value which should be tied to the item */ value: T; /** Sets this items as view only or disabled */ disabled?: boolean; } interface UniqueItem { id: string; optionItem: DropdownItem; selected: boolean; } interface DisplayItem extends UniqueItem { className: string; } export {};