|
|
import _FocusMixin = require("./_FocusMixin");
|
|
|
import _WidgetBase = require("./_WidgetBase");
|
|
|
import { Deferred } from "dojo/Deferred";
|
|
|
import { PlaceLocation } from "./place";
|
|
|
|
|
|
interface _HasDropDown<T extends _WidgetBase> extends _FocusMixin {
|
|
|
/**
|
|
|
* The button/icon/node to click to display the drop down.
|
|
|
* Can be set via a data-dojo-attach-point assignment.
|
|
|
* If missing, then either focusNode or domNode (if focusNode is also missing) will be used.
|
|
|
*/
|
|
|
_buttonNode: HTMLElement;
|
|
|
|
|
|
/**
|
|
|
* Will set CSS class dijitUpArrow, dijitDownArrow, dijitRightArrow etc. on this node depending
|
|
|
* on where the drop down is set to be positioned.
|
|
|
* Can be set via a data-dojo-attach-point assignment.
|
|
|
* If missing, then _buttonNode will be used.
|
|
|
*/
|
|
|
_arrowWrapperNode: HTMLElement;
|
|
|
|
|
|
/**
|
|
|
* The node to set the aria-expanded class on.
|
|
|
* Also sets popupActive class but that will be removed in 2.0.
|
|
|
* Can be set via a data-dojo-attach-point assignment.
|
|
|
* If missing, then focusNode or _buttonNode (if focusNode is missing) will be used.
|
|
|
*/
|
|
|
_popupStateNode: HTMLElement;
|
|
|
|
|
|
/**
|
|
|
* The node to display the popup around.
|
|
|
* Can be set via a data-dojo-attach-point assignment.
|
|
|
* If missing, then domNode will be used.
|
|
|
*/
|
|
|
_aroundNode: HTMLElement;
|
|
|
|
|
|
/**
|
|
|
* The widget to display as a popup. This widget *must* be
|
|
|
* defined before the startup function is called.
|
|
|
*/
|
|
|
dropDown: T;
|
|
|
|
|
|
/**
|
|
|
* Set to true to make the drop down at least as wide as this
|
|
|
* widget. Set to false if the drop down should just be its
|
|
|
* default width.
|
|
|
*/
|
|
|
autoWidth: boolean;
|
|
|
|
|
|
/**
|
|
|
* Set to true to make the drop down exactly as wide as this
|
|
|
* widget. Overrides autoWidth.
|
|
|
*/
|
|
|
forceWidth: boolean;
|
|
|
|
|
|
/**
|
|
|
* The max height for our dropdown.
|
|
|
* Any dropdown taller than this will have scrollbars.
|
|
|
* Set to 0 for no max height, or -1 to limit height to available space in viewport
|
|
|
*/
|
|
|
maxHeight: number;
|
|
|
|
|
|
/**
|
|
|
* This variable controls the position of the drop down.
|
|
|
* It's an array of strings
|
|
|
*/
|
|
|
dropDownPosition: string[];
|
|
|
/* TODO remove for TS 1.8 */
|
|
|
/* dropDownPosition: ('before' | 'after' | 'above' | 'below')[]; */
|
|
|
|
|
|
/**
|
|
|
* When set to false, the click events will not be stopped, in
|
|
|
* case you want to use them in your subclass
|
|
|
*/
|
|
|
_stopClickEvents: boolean;
|
|
|
|
|
|
/**
|
|
|
* Callback when the user mousedown/touchstart on the arrow icon.
|
|
|
*/
|
|
|
_onDropDownMouseDown(e: MouseEvent): void;
|
|
|
|
|
|
/**
|
|
|
* Callback on mouseup/touchend after mousedown/touchstart on the arrow icon.
|
|
|
* Note that this function is called regardless of what node the event occurred on (but only after
|
|
|
* a mousedown/touchstart on the arrow).
|
|
|
*/
|
|
|
_onDropDownMouseUp(e?: MouseEvent): void;
|
|
|
|
|
|
/**
|
|
|
* The drop down was already opened on mousedown/keydown; just need to stop the event
|
|
|
*/
|
|
|
_onDropDownClick(e: MouseEvent): void;
|
|
|
|
|
|
buildRendering(): void;
|
|
|
postCreate(): void;
|
|
|
destroy(preserveDom?: boolean): void;
|
|
|
|
|
|
/**
|
|
|
* Returns true if the dropdown exists and it's data is loaded. This can
|
|
|
* be overridden in order to force a call to loadDropDown().
|
|
|
*/
|
|
|
isLoaded(): boolean;
|
|
|
|
|
|
/**
|
|
|
* Creates the drop down if it doesn't exist, loads the data
|
|
|
* if there's an href and it hasn't been loaded yet, and then calls
|
|
|
* the given callback.
|
|
|
*/
|
|
|
loadDropDown(loadCallback: () => void): void;
|
|
|
|
|
|
/**
|
|
|
* Creates the drop down if it doesn't exist, loads the data
|
|
|
* if there's an href and it hasn't been loaded yet, and
|
|
|
* then opens the drop down. This is basically a callback when the
|
|
|
* user presses the down arrow button to open the drop down.
|
|
|
*/
|
|
|
loadAndOpenDropDown(): Deferred<T>;
|
|
|
|
|
|
/**
|
|
|
* Callback when the user presses the down arrow button or presses
|
|
|
* the down arrow key to open/close the drop down.
|
|
|
* Toggle the drop-down widget; if it is up, close it, if not, open it
|
|
|
*/
|
|
|
toggleDropDown(): void;
|
|
|
|
|
|
/**
|
|
|
* Opens the dropdown for this widget. To be called only when this.dropDown
|
|
|
* has been created and is ready to display (ie, it's data is loaded).
|
|
|
*/
|
|
|
openDropDown(): PlaceLocation;
|
|
|
|
|
|
/**
|
|
|
* Closes the drop down on this widget
|
|
|
*/
|
|
|
closeDropDown(focus?: boolean): void;
|
|
|
}
|
|
|
|
|
|
type _HasDropDownConstructor<T extends _WidgetBase = _WidgetBase> = _HasDropDown<T>;
|
|
|
declare const _HasDropDown: _HasDropDownConstructor;
|
|
|
export = _HasDropDown;
|
|
|
|