/*!
- * OOUI v0.27.0
+ * OOUI v0.27.3
* https://www.mediawiki.org/wiki/OOUI
*
* Copyright 2011–2018 OOUI Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2018-05-09T00:44:45Z
+ * Date: 2018-06-07T21:36:30Z
*/
( function ( OO ) {
* @cfg {jQuery} [$overlay] Overlay for the lookup menu; defaults to relative positioning.
* See <https://www.mediawiki.org/wiki/OOUI/Concepts#Overlays>.
* @cfg {jQuery} [$container=this.$element] The container element. The lookup menu is rendered beneath the specified element.
+ * @cfg {Object} [menu] Configuration options to pass to {@link OO.ui.MenuSelectWidget menu select widget}
* @cfg {boolean} [allowSuggestionsWhenEmpty=false] Request and display a lookup menu when the text input is empty.
* By default, the lookup menu is not generated and displayed until the user begins to type.
* @cfg {boolean} [highlightFirst=true] Whether the first lookup result should be highlighted (so, that the user can
// Properties
this.$overlay = ( config.$overlay === true ? OO.ui.getDefaultOverlay() : config.$overlay ) || this.$element;
- this.lookupMenu = new OO.ui.MenuSelectWidget( {
+ this.lookupMenu = new OO.ui.MenuSelectWidget( $.extend( {
widget: this,
input: this,
$floatableContainer: config.$container || this.$element
- } );
+ }, config.menu ) );
this.allowSuggestionsWhenEmpty = config.allowSuggestionsWhenEmpty || false;
} else {
promise = $.Deferred().resolve();
}
- // Focus the first element on the newly selected panel
- if ( this.autoFocus && !OO.ui.isMobile() ) {
+ // Focus the first element on the newly selected panel.
+ // Don't focus if the page was set by scrolling.
+ if ( this.autoFocus && !OO.ui.isMobile() && !this.scrolling ) {
promise.done( function () {
layout.focus();
} );
* @class
* @extends OO.ui.Widget
* @mixins OO.ui.mixin.GroupElement
- * @mixins OO.ui.mixin.IconElement
*
* @constructor
* @param {OO.ui.OutlineSelectWidget} outline Outline to control
}
// Configuration initialization
- config = $.extend( { icon: 'add' }, config );
+ config = config || {};
// Parent constructor
OO.ui.OutlineControlsWidget.parent.call( this, config );
// Mixin constructors
OO.ui.mixin.GroupElement.call( this, config );
- OO.ui.mixin.IconElement.call( this, config );
// Properties
this.outline = outline;
OO.inheritClass( OO.ui.OutlineControlsWidget, OO.ui.Widget );
OO.mixinClass( OO.ui.OutlineControlsWidget, OO.ui.mixin.GroupElement );
-OO.mixinClass( OO.ui.OutlineControlsWidget, OO.ui.mixin.IconElement );
/* Events */
* @fires remove
*/
OO.ui.TagItemWidget.prototype.remove = function () {
- if ( !this.isDisabled() ) {
+ if ( !this.isDisabled() && !this.isFixed() ) {
this.emit( 'remove' );
}
};
items = this.getItems();
item = items[ items.length - 1 ];
- if ( !item.isDisabled() ) {
+ if ( !item.isDisabled() && !item.isFixed() ) {
this.removeItems( [ item ] );
// If Ctrl/Cmd was pressed, delete item entirely.
// Otherwise put it into the text field for editing.
* var widget = new OO.ui.MenuTagMultiselectWidget( {
* inputPosition: 'outline',
* options: [
- * { data: 'option1', label: 'Option 1' },
+ * { data: 'option1', label: 'Option 1', icon: 'tag' },
* { data: 'option2', label: 'Option 2' },
* { data: 'option3', label: 'Option 3' },
* ],
OO.ui.MenuTagMultiselectWidget.prototype.addOptions = function ( menuOptions ) {
var widget = this,
items = menuOptions.map( function ( obj ) {
- return widget.createMenuOptionWidget( obj.data, obj.label );
+ return widget.createMenuOptionWidget( obj.data, obj.label, obj.icon );
} );
this.menu.addItems( items );
*
* @param {string} data Item data
* @param {string} [label] Item label
+ * @param {string} [icon] Symbolic icon name
* @return {OO.ui.OptionWidget} Option widget
*/
-OO.ui.MenuTagMultiselectWidget.prototype.createMenuOptionWidget = function ( data, label ) {
+OO.ui.MenuTagMultiselectWidget.prototype.createMenuOptionWidget = function ( data, label, icon ) {
return new OO.ui.MenuOptionWidget( {
data: data,
- label: label || data
+ label: label || data,
+ icon: icon
} );
};
}( OO ) );
-//# sourceMappingURL=oojs-ui-widgets.js.map
\ No newline at end of file
+//# sourceMappingURL=oojs-ui-widgets.js.map.json
\ No newline at end of file