/*!
- * OOjs UI v0.24.2
+ * OOjs UI v0.25.0
* https://www.mediawiki.org/wiki/OOjs_UI
*
- * Copyright 2011–2017 OOjs UI Team and other contributors.
+ * Copyright 2011–2018 OOjs UI Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2017-11-07T22:52:40Z
+ * Date: 2018-01-10T00:26:02Z
*/
( function ( OO ) {
}
this.$element
.addClass( 'oo-ui-draggableGroupElement' )
- .append( this.$status )
.toggleClass( 'oo-ui-draggableGroupElement-horizontal', this.orientation === 'horizontal' );
};
OO.ui.mixin.RequestManager.call( this, config );
// Properties
- this.$overlay = config.$overlay || this.$element;
+ this.$overlay = ( config.$overlay === true ? OO.ui.getDefaultOverlay() : config.$overlay ) || this.$element;
this.lookupMenu = new OO.ui.MenuSelectWidget( {
widget: this,
input: this,
prev = pages[ index - 1 ];
// Prefer adjacent pages at the same level
if ( this.outlined ) {
- level = this.outlineSelectWidget.getItemFromData( page.getName() ).getLevel();
+ level = this.outlineSelectWidget.findItemFromData( page.getName() ).getLevel();
if (
prev &&
- level === this.outlineSelectWidget.getItemFromData( prev.getName() ).getLevel()
+ level === this.outlineSelectWidget.findItemFromData( prev.getName() ).getLevel()
) {
return prev;
}
if (
next &&
- level === this.outlineSelectWidget.getItemFromData( next.getName() ).getLevel()
+ level === this.outlineSelectWidget.findItemFromData( next.getName() ).getLevel()
) {
return next;
}
return prev || next || null;
};
-/**
- * Get the page closest to the specified page.
- *
- * @deprecated 0.23.0 Use {@link OO.ui.BookletLayout#findClosestPage} instead.
- * @param {OO.ui.PageLayout} page Page to use as a reference point
- * @return {OO.ui.PageLayout|null} Page closest to the specified page
- */
-OO.ui.BookletLayout.prototype.getClosestPage = function ( page ) {
- OO.ui.warnDeprecation( 'BookletLayout#getClosestPage: Deprecated function. Use findClosestPage instead. See T76630.' );
- return this.findClosestPage( page );
-};
-
/**
* Get the outline widget.
*
name = page.getName();
delete this.pages[ name ];
if ( this.outlined ) {
- items.push( this.outlineSelectWidget.getItemFromData( name ) );
+ items.push( this.outlineSelectWidget.findItemFromData( name ) );
page.setOutlineItem( null );
}
}
next = tabPanels[ index + 1 ];
prev = tabPanels[ index - 1 ];
// Prefer adjacent tab panels at the same level
- level = this.tabSelectWidget.getItemFromData( tabPanel.getName() ).getLevel();
+ level = this.tabSelectWidget.findItemFromData( tabPanel.getName() ).getLevel();
if (
prev &&
- level === this.tabSelectWidget.getItemFromData( prev.getName() ).getLevel()
+ level === this.tabSelectWidget.findItemFromData( prev.getName() ).getLevel()
) {
return prev;
}
if (
next &&
- level === this.tabSelectWidget.getItemFromData( next.getName() ).getLevel()
+ level === this.tabSelectWidget.findItemFromData( next.getName() ).getLevel()
) {
return next;
}
tabPanel = tabPanels[ i ];
name = tabPanel.getName();
delete this.tabPanels[ name ];
- items.push( this.tabSelectWidget.getItemFromData( name ) );
+ items.push( this.tabSelectWidget.findItemFromData( name ) );
tabPanel.setTabItem( null );
}
if ( items.length ) {
// Configuration initialization
config = $.extend( {
allowArbitrary: false,
- allowDuplicates: false,
- $overlay: this.$element
+ allowDuplicates: false
}, config );
// Properties (must be set before mixin constructor calls)
this.$content = $( '<div>' );
this.allowArbitrary = config.allowArbitrary;
this.allowDuplicates = config.allowDuplicates;
- this.$overlay = config.$overlay;
+ this.$overlay = ( config.$overlay === true ? OO.ui.getDefaultOverlay() : config.$overlay ) || this.$element;
this.menu = new OO.ui.MenuSelectWidget( $.extend(
{
widget: this,
$.each( datas, function ( i, data ) {
var j, label,
- item = menu.getItemFromData( data );
+ item = menu.findItemFromData( data );
if ( item ) {
label = item.label;
$.each( datas, function ( i, data ) {
var item;
- if ( !widget.getItemFromData( data ) || widget.allowDuplicates ) {
- item = menu.getItemFromData( data );
+ if ( !widget.findItemFromData( data ) || widget.allowDuplicates ) {
+ item = menu.findItemFromData( data );
if ( item ) {
item = widget.createItemWidget( data, item.label );
} else if ( widget.allowArbitrary ) {
items = [];
$.each( datas, function ( i, data ) {
- var item = widget.getItemFromData( data );
+ var item = widget.findItemFromData( data );
if ( item ) {
items.push( item );
}
* A basic tag multiselect widget, similar in concept to {@link OO.ui.ComboBoxInputWidget combo box widget}
* that allows the user to add multiple values that are displayed in a tag area.
*
- * For more information about menus and options, please see the [OOjs UI documentation on MediaWiki][1].
- *
* This widget is a base widget; see {@link OO.ui.MenuTagMultiselectWidget MenuTagMultiselectWidget} and
* {@link OO.ui.PopupTagMultiselectWidget PopupTagMultiselectWidget} for the implementations that use
* a menu and a popup respectively.
* } );
* $( 'body' ).append( widget.$element );
*
- * [1]: https://www.mediawiki.org/wiki/OOjs_UI/Widgets/Selects_and_Options#Menu_selects_and_options
- *
* @class
* @extends OO.ui.Widget
* @mixins OO.ui.mixin.GroupWidget
* @return {boolean} Value is duplicate
*/
OO.ui.TagMultiselectWidget.prototype.isDuplicateData = function ( data ) {
- return !!this.getItemFromData( data );
+ return !!this.findItemFromData( data );
};
/**
* @param {string|Object} data Tag data
*/
OO.ui.TagMultiselectWidget.prototype.removeTagByData = function ( data ) {
- var item = this.getItemFromData( data );
+ var item = this.findItemFromData( data );
this.removeItems( [ item ] );
};
* PopupTagMultiselectWidget is a {@link OO.ui.TagMultiselectWidget OO.ui.TagMultiselectWidget} intended
* to use a popup. The popup can be configured to have a default input to insert values into the widget.
*
- * For more information about menus and options, please see the [OOjs UI documentation on MediaWiki][1].
- *
* @example
* // Example: A basic PopupTagMultiselectWidget.
* var widget = new OO.ui.PopupTagMultiselectWidget();
* } );
* $( 'body' ).append( widget.$element );
*
- * [1]: https://www.mediawiki.org/wiki/OOjs_UI/Widgets/Selects_and_Options#Menu_selects_and_options
- *
* @class
* @extends OO.ui.TagMultiselectWidget
* @mixins OO.ui.mixin.PopupElement
// Parent constructor
OO.ui.PopupTagMultiselectWidget.parent.call( this, $.extend( { inputPosition: 'none' }, config ) );
- this.$overlay = config.$overlay || this.$element;
+ this.$overlay = ( config.$overlay === true ? OO.ui.getDefaultOverlay() : config.$overlay ) || this.$element;
if ( !config.popup ) {
// For the default base implementation, we give a popup
* MenuTagMultiselectWidget is a {@link OO.ui.TagMultiselectWidget OO.ui.TagMultiselectWidget} intended
* to use a menu of selectable options.
*
- * For more information about menus and options, please see the [OOjs UI documentation on MediaWiki][1].
- *
* @example
* // Example: A basic MenuTagMultiselectWidget.
* var widget = new OO.ui.MenuTagMultiselectWidget( {
* } );
* $( 'body' ).append( widget.$element );
*
- * [1]: https://www.mediawiki.org/wiki/OOjs_UI/Widgets/Selects_and_Options#Menu_selects_and_options
- *
* @class
* @extends OO.ui.TagMultiselectWidget
*
// Parent constructor
OO.ui.MenuTagMultiselectWidget.parent.call( this, config );
- this.$overlay = config.$overlay || this.$element;
+ this.$overlay = ( config.$overlay === true ? OO.ui.getDefaultOverlay() : config.$overlay ) || this.$element;
this.menu = this.createMenuWidget( $.extend( {
widget: this,
$input: this.hasInput ? this.input.$input : null,
filterFromInput: !!this.hasInput,
$autoCloseIgnore: this.hasInput ?
- this.input.$element.add( this.$overlay ) : this.$overlay,
+ this.input.$element : $( [] ),
$floatableContainer: this.hasInput && this.inputPosition === 'outline' ?
this.input.$element : this.$element,
$overlay: this.$overlay,
* @inheritdoc
*/
OO.ui.MenuTagMultiselectWidget.prototype.onTagSelect = function ( tagItem ) {
- var menuItem = this.menu.getItemFromData( tagItem.getData() );
+ var menuItem = this.menu.findItemFromData( tagItem.getData() );
// Override the base behavior from TagMultiselectWidget; the base behavior
// in TagMultiselectWidget is to remove the tag to edit it in the input,
// but in our case, we want to utilize the menu selection behavior, and
// definitely not remove the item.
+ // If there is an input that is used for filtering, erase the value so we don't filter
+ if ( this.hasInput && this.menu.filterFromInput ) {
+ this.input.setValue( '' );
+ }
+
// Select the menu item
this.menu.selectItem( menuItem );
var inputValue = this.input.getValue(),
validated = false,
highlightedItem = this.menu.findHighlightedItem(),
- item = this.menu.getItemFromData( inputValue );
+ item = this.menu.findItemFromData( inputValue );
// Override the parent method so we add from the menu
// rather than directly from the input