import { Sifter } from '@orchidjs/sifter'; import { TomInput, TomArgObject, TomOption, TomOptions, TomCreateCallback, TomItem, TomSettings, TomTemplateNames, TomClearFilter, RecursivePartial } from './types/index'; declare const TomSelect_base: { new (): { [x: string]: any; plugins: { names: string[]; settings: { [key: string]: any; }; requested: { [key: string]: boolean; }; loaded: { [key: string]: any; }; }; initializePlugins(plugins: string[] | import("./contrib/microplugin").TPluginHash | import("./contrib/microplugin").TPluginItem[]): void; loadPlugin(name: string): void; require(name: string): any; }; [x: string]: any; define(name: string, fn: (this: any, settings: { [key: string]: any; }) => any): void; }; export default class TomSelect extends TomSelect_base { control_input: HTMLInputElement; wrapper: HTMLElement; dropdown: HTMLElement; control: HTMLElement; dropdown_content: HTMLElement; focus_node: HTMLElement; order: number; settings: TomSettings; input: TomInput; tabIndex: number; is_select_tag: boolean; rtl: boolean; private inputId; private _destroy; sifter: Sifter; isOpen: boolean; isDisabled: boolean; isReadOnly: boolean; isRequired: boolean; isInvalid: boolean; isValid: boolean; isLocked: boolean; isFocused: boolean; isInputHidden: boolean; isSetup: boolean; ignoreFocus: boolean; ignoreHover: boolean; hasOptions: boolean; currentResults?: ReturnType; lastValue: string; caretPos: number; loading: number; loadedSearches: { [key: string]: boolean; }; activeOption: null | HTMLElement; activeItems: TomItem[]; optgroups: TomOptions; options: TomOptions; userOptions: { [key: string]: boolean; }; items: string[]; private refreshTimeout; constructor(input_arg: string | TomInput, user_settings: RecursivePartial); /** * set up event bindings. * */ setup(): void; /** * Register options and optgroups * */ setupOptions(options?: TomOption[], optgroups?: TomOption[]): void; /** * Sets up default rendering functions. */ setupTemplates(): void; /** * Maps fired events to callbacks provided * in the settings used when creating the control. */ setupCallbacks(): void; /** * Sync the Tom Select instance with the original input or select * */ sync(get_settings?: boolean): void; /** * Triggered when the main control element * has a click event. * */ onClick(): void; /** * @deprecated v1.7 * */ onMouseDown(): void; /** * Triggered when the value of the control has been changed. * This should propagate the event to the original DOM * input / select element. */ onChange(): void; /** * Triggered on paste. * */ onPaste(e: MouseEvent | KeyboardEvent): void; /** * Triggered on keypress. * */ onKeyPress(e: KeyboardEvent): void; /** * Triggered on keydown. * */ onKeyDown(e: KeyboardEvent): void; /** * Triggered on keyup. * */ onInput(e: MouseEvent | KeyboardEvent): void; _onInput(): void; /** * Triggered when the user rolls over * an option in the autocomplete dropdown menu. * */ onOptionHover(evt: MouseEvent | KeyboardEvent, option: HTMLElement): void; /** * Triggered on focus. * */ onFocus(e?: MouseEvent | KeyboardEvent): void; /** * Triggered on blur. * */ onBlur(e?: FocusEvent): void; /** * Triggered when the user clicks on an option * in the autocomplete dropdown menu. * */ onOptionSelect(evt: MouseEvent | KeyboardEvent, option: HTMLElement): void; /** * Return true if the given option can be selected * */ canSelect(option: HTMLElement | null): boolean; /** * Triggered when the user clicks on an item * that has been selected. * */ onItemSelect(evt?: MouseEvent, item?: TomItem): boolean; /** * Determines whether or not to invoke * the user-provided option provider / loader * * Note, there is a subtle difference between * this.canLoad() and this.settings.shouldLoad(); * * - settings.shouldLoad() is a user-input validator. * When false is returned, the not_loading template * will be added to the dropdown * * - canLoad() is lower level validator that checks * the Tom Select instance. There is no inherent user * feedback when canLoad returns false * */ canLoad(value: string): boolean; /** * Invokes the user-provided option provider / loader. * */ load(value: string): void; /** * Invoked by the user-provided option provider * */ loadCallback(options: TomOption[], optgroups: TomOption[]): void; preload(): void; /** * Sets the input field of the control to the specified value. * */ setTextboxValue(value?: string): void; /** * Returns the value of the control. If multiple items * can be selected (e.g. or * element to reflect the current state. * */ updateOriginalInput(opts?: TomArgObject): void; /** * Shows the autocomplete dropdown containing * the available options. */ open(): void; /** * Closes the autocomplete dropdown menu. */ close(setTextboxValue?: boolean): void; /** * Calculates and applies the appropriate * position of the dropdown if dropdownParent = 'body'. * Otherwise, position is determined by css */ positionDropdown(): void; /** * Resets / clears all selected items * from the control. * */ clear(silent?: boolean): void; /** * A helper method for inserting an element * at the current caret position. * */ insertAtCaret(el: HTMLElement): void; /** * Removes the current selected item(s). * */ deleteSelection(e: KeyboardEvent): boolean; /** * Return true if the items should be deleted */ shouldDelete(items: TomItem[], evt: MouseEvent | KeyboardEvent): boolean; /** * Selects the previous / next item (depending on the `direction` argument). * * > 0 - right * < 0 - left * */ advanceSelection(direction: number, e?: MouseEvent | KeyboardEvent): void; moveCaret(direction: number): void; /** * Get the last active item * */ getLastActive(direction?: number): any; /** * Moves the caret to the specified index. * * The input must be moved by leaving it in place and moving the * siblings, due to the fact that focus cannot be restored once lost * on mobile webkit devices * */ setCaret(new_pos: number): void; /** * Return list of item dom elements * */ controlChildren(): TomItem[]; /** * Disables user input on the control. Used while * items are being asynchronously created. */ lock(): void; /** * Re-enables user input on the control. */ unlock(): void; /** * Disable or enable user input on the control */ setLocked(lock?: boolean): void; /** * Disables user input on the control completely. * While disabled, it cannot receive focus. */ disable(): void; /** * Enables the control so that it can respond * to focus and user input. */ enable(): void; setDisabled(disabled: boolean): void; setReadOnly(isReadOnly: boolean): void; /** * Completely destroys the control and * unbinds all event listeners so that it can * be garbage collected. */ destroy(): void; /** * A helper method for rendering "item" and * "option" templates, given the data. * */ render(templateName: TomTemplateNames, data?: any): null | HTMLElement; /** * Type guarded rendering * */ _render(templateName: TomTemplateNames, data?: any): HTMLElement; /** * Clears the render cache for a template. If * no template is given, clears all render * caches. * */ clearCache(): void; /** * Removes a value from item and option caches * */ uncacheValue(value: string): void; /** * Determines whether or not to display the * create item prompt, given a user input. * */ canCreate(input: string): boolean; /** * Wraps this.`method` so that `new_fn` can be invoked 'before', 'after', or 'instead' of the original method * * this.hook('instead','onKeyDown',function( arg1, arg2 ...){ * * }); */ hook(when: string, method: string, new_fn: any): void; } export {};