Show drop downs (ex: the select list of a ComboBox) or popups (ex: right-click context menus).
Methods
-
<static> close(popup)
-
Close specified popup and any popups that it parented. If no popup is specified, closes all popups.
Parameters:
Name Type Argument Description popupmodule:delite/Widget <optional>
- Source:
-
<static> detach(widget)
-
Detach specified popup widget from document
Parameters:
Name Type Description widgetmodule:delite/Widget - Source:
-
<static> getTopPopup() → {module:delite/Widget}
-
Compute the closest ancestor popup that's not a child of another popup. Ex: For a TooltipDialog with a button that spawns a tree of menus, find the popup of the button.
- Source:
Returns:
- Type
- module:delite/Widget
-
<static> hide(widget)
-
Hide this popup widget (until it is ready to be shown). Initialization for widgets that will be used as popups.
Also puts widget inside a wrapper DIV (if not already in one).
If popup widget needs to layout it should do so when it is made visible, and popup._onShow() is called.
Parameters:
Name Type Description widgetmodule:delite/Widget - Source:
-
<static> moveOffScreen(widget) → {HTMLElement}
-
Moves the popup widget off-screen. Do not use this method to hide popups when not in use, because that will create an accessibility issue: the offscreen popup will still be in the tabbing order.
Parameters:
Name Type Description widgetmodule:delite/Widget - Source:
Returns:
- Type
- HTMLElement
-
<static> open(args) → {*}
-
Popup the widget at the specified position.
Note that whatever widget called delite/popup.open() should also require activationTracker and listen for delite-deactivated event to know that focus has moved somewhere else and thus the popup should be closed.
Parameters:
Name Type Description argsmodule:delite/popup.OpenArgs - Source:
Returns:
If orient !== center then returns the alignment of the popup relative to the anchor node.
- Type
- *
Examples
// Open at the mouse position popup.open({popup: menuWidget, x: evt.pageX, y: evt.pageY});// Open the widget as a dropdown popup.open({parent: this, popup: menuWidget, around: this, onClose: function(){...}});
Type Definitions
-
OpenArgs
-
Arguments to
delite/popup#open()method.Type:
- Object
- hitting ESC or TAB key
- using the popup widget's proprietary cancel mechanism (like a cancel button in a dialog), causing the widget to emit a "cancel" event
- Source:
Properties:
Name Type Description popupmodule:delite/Widget The Widget to display.
parentmodule:delite/Widget The button etc. that is displaying this popup.
aroundElement | Rectangle DOM node (typically a button); place popup relative to this node. (Specify this or
xandyproperties.)xnumber Absolute horizontal position (in pixels) to place node at. (Specify this or
aroundparameter.)ynumber Absolute vertical position (in pixels) to place node at. (Specify this or
aroundparameter.)orientArray.<string> When the
aroundparameter is specified,orientshould be a list of positions to try, ex.[ "below", "above" ]delite/popup.open()tries to position the popup according to each specified position, in order, until the popup appears fully within the viewport. The default value is["below", "above"]. When an(x,y)position is specified rather than anaroundnode,orientis either "R" or "L". R (for right) means that it tries to put the popup to the right of the mouse, specifically positioning the popup's top-right corner at the mouse position, and if that doesn't fit in the viewport, then it tries, in order, the bottom-right corner, the top left corner, and the top-right corner.Alternately,
orientcan be an array["center"], which pops up the specified node in the center of the viewport, like a dialog. It will shrink the size of the node if necessary, in which case the node must be designed so that scrolling occurs in the right place.onCancelfunction Callback when user has canceled the popup by:
onExecutefunction Callback when user has executed the popup by using the popup widget's proprietary execute mechanism (like an OK button in a dialog, or clicking a choice in a dropdown list), causing the widget to emit an "execute" or "change" event.
onClosefunction Callback whenever this popup is closed.
paddingPosition Adding a buffer around the opening position. This is only used when
aroundis not set.maxHeightnumber The maximum height for the popup. Any popup taller than this will have scroll bars. Set to
Infinityfor no max height. Default is to limit height to available space in viewport, above or below thearoundNodeor specifiedx/yposition.