/**
* PopupElement is mixed into other classes to generate a {@link OO.ui.PopupWidget popup widget}.
* A popup is a container for content. It is overlaid and positioned absolutely. By default, each
* popup has an anchor, which is an arrow-like protrusion that points toward the popup’s origin.
* See {@link OO.ui.PopupWidget PopupWidget} for an example.
*
* @mixin
*
* @param {Object} [config] Configuration options
* @param {Object} [config.popup] Configuration to pass to popup
* @param {boolean} [config.popup.autoClose=true] Popup auto-closes when it loses focus
*/
OO.ui.mixin.PopupElement = function OoUiMixinPopupElement( config ) {
// Configuration initialization
config = config || {};
// Properties
this.popup = new OO.ui.PopupWidget( $.extend(
{
autoClose: true,
$floatableContainer: this.$element
},
config.popup,
{
$autoCloseIgnore: this.$element.add( config.popup && config.popup.$autoCloseIgnore )
}
) );
};
/* Methods */
/**
* Get popup.
*
* @return {OO.ui.PopupWidget} Popup widget
*/
OO.ui.mixin.PopupElement.prototype.getPopup = function () {
return this.popup;
};