47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
interface DropdownItem {
|
|
value: string;
|
|
text: string;
|
|
html?: HTMLElement
|
|
}
|
|
|
|
export interface DropdownOptions {
|
|
textkey?: string;
|
|
valuekey?: string;
|
|
htmlkey?: string;
|
|
maxlength?: Number;
|
|
multiselect?: boolean;
|
|
selected?: string;
|
|
selectedlist?: Array<string>;
|
|
disabled?: boolean;
|
|
input?: boolean;
|
|
search?: boolean;
|
|
searchkeys?: Array<string>;
|
|
searchplaceholder?: string;
|
|
tabindex?: Number;
|
|
placeholder?: string;
|
|
slidefixed?: boolean;
|
|
parent?: HTMLElement;
|
|
}
|
|
|
|
export class Dropdown {
|
|
static resolve(dom?: HTMLElement): HTMLElement;
|
|
|
|
constructor(options?: DropdownOptions);
|
|
|
|
sourceFilter: () => Array<DropdownItem | any>;
|
|
onselected: (item: DropdownItem | any) => void;
|
|
onselectedlist: (list: Array<DropdownItem | any>) => void;
|
|
onexpanded: () => void;
|
|
|
|
get disabled(): boolean;
|
|
set disabled(flag: boolean);
|
|
get source(): Array<DropdownItem | any>;
|
|
set source(list: Array<DropdownItem | any>);
|
|
readonly multiselect: boolean;
|
|
readonly selected: DropdownItem | any;
|
|
readonly selectedlist: Array<DropdownItem | any>;
|
|
create(): HTMLElement;
|
|
select(selected: string, silence?: boolean): void;
|
|
selectlist(selectedlist: Array<string>, silence?: boolean): void;
|
|
}
|