Update OOUI to v0.27.3
[lhc/web/wiklou.git] / resources / lib / oojs-ui / oojs-ui-widgets.js
index 5b0b64a..d9e8ae0 100644 (file)
@@ -1,12 +1,12 @@
 /*!
- * 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 ) {
 
@@ -631,6 +631,7 @@ OO.ui.mixin.RequestManager.prototype.getRequestCacheDataFromResponse = null;
  * @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
@@ -645,11 +646,11 @@ OO.ui.mixin.LookupElement = function OoUiMixinLookupElement( config ) {
 
        // 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;
 
@@ -1893,8 +1894,9 @@ OO.ui.BookletLayout.prototype.onStackLayoutSet = function ( page ) {
        } 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();
                } );
@@ -3032,7 +3034,6 @@ OO.ui.ToggleSwitchWidget.prototype.simulateLabelClick = function () {
  * @class
  * @extends OO.ui.Widget
  * @mixins OO.ui.mixin.GroupElement
- * @mixins OO.ui.mixin.IconElement
  *
  * @constructor
  * @param {OO.ui.OutlineSelectWidget} outline Outline to control
@@ -3049,14 +3050,13 @@ OO.ui.OutlineControlsWidget = function OoUiOutlineControlsWidget( outline, confi
        }
 
        // 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;
@@ -3102,7 +3102,6 @@ OO.ui.OutlineControlsWidget = function OoUiOutlineControlsWidget( outline, confi
 
 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 */
 
@@ -4682,7 +4681,7 @@ OO.ui.TagItemWidget.prototype.setDisabled = function ( state ) {
  * @fires remove
  */
 OO.ui.TagItemWidget.prototype.remove = function () {
-       if ( !this.isDisabled() ) {
+       if ( !this.isDisabled() && !this.isFixed() ) {
                this.emit( 'remove' );
        }
 };
@@ -5127,7 +5126,7 @@ OO.ui.TagMultiselectWidget.prototype.doInputBackspace = function ( e, withMetaKe
                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.
@@ -5786,7 +5785,7 @@ OO.ui.PopupTagMultiselectWidget.prototype.addTagByPopupValue = function ( data,
  *     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' },
  *         ],
@@ -6012,7 +6011,7 @@ OO.ui.MenuTagMultiselectWidget.prototype.createMenuWidget = function ( menuConfi
 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 );
@@ -6023,12 +6022,14 @@ OO.ui.MenuTagMultiselectWidget.prototype.addOptions = function ( menuOptions ) {
  *
  * @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
        } );
 };
 
@@ -6712,4 +6713,4 @@ OO.ui.SearchWidget.prototype.getResults = function () {
 
 }( 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