X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=resources%2Flib%2Foojs-ui%2Foojs-ui-widgets.js;h=6460ae461fa8faa90a1a35803c39a96f677d56d3;hb=946e506a91f4a6f3dbe50c29ab255ea8614a8dce;hp=3c5d16c7bfc7acc31e4256c5d7e0d1446c1ebe60;hpb=3b70100a856c511b0a84eed2e522dabb0b332cd2;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/lib/oojs-ui/oojs-ui-widgets.js b/resources/lib/oojs-ui/oojs-ui-widgets.js index 3c5d16c7bf..6460ae461f 100644 --- a/resources/lib/oojs-ui/oojs-ui-widgets.js +++ b/resources/lib/oojs-ui/oojs-ui-widgets.js @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.21.4 + * OOjs UI v0.22.2 * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2017 OOjs UI Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2017-05-16T22:31:39Z + * Date: 2017-06-28T19:51:59Z */ ( function ( OO ) { @@ -1976,10 +1976,19 @@ OO.ui.BookletLayout.prototype.isOutlineVisible = function () { * @chainable */ OO.ui.BookletLayout.prototype.toggleOutline = function ( show ) { + var booklet = this; + if ( this.outlined ) { show = show === undefined ? !this.outlineVisible : !!show; this.outlineVisible = show; this.toggleMenu( show ); + if ( show && this.editable ) { + // HACK: When the sidebar stops animating, kill dumb scrollbars (T161798). Only necessary when + // outline controls are present, The delay matches transition on `.oo-ui-menuLayout-menu`. + setTimeout( function () { + OO.ui.Element.static.reconsiderScrollbars( booklet.outlinePanel.$element[ 0 ] ); + }, 200 ); + } } return this; @@ -3136,6 +3145,16 @@ OO.ui.ToggleSwitchWidget.prototype.setValue = function ( value ) { return this; }; +/** + * @inheritdoc + */ +OO.ui.ToggleSwitchWidget.prototype.simulateLabelClick = function () { + if ( !this.isDisabled() ) { + this.setValue( !this.value ); + } + this.focus(); +}; + /** * OutlineControlsWidget is a set of controls for an {@link OO.ui.OutlineSelectWidget outline select widget}. * Controls include moving items up and down, removing items, and adding different kinds of items. @@ -3186,7 +3205,7 @@ OO.ui.OutlineControlsWidget = function OoUiOutlineControlsWidget( outline, confi } ); this.removeButton = new OO.ui.ButtonWidget( { framed: false, - icon: 'remove', + icon: 'trash', title: OO.ui.msg( 'ooui-outline-control-remove' ) } ); this.abilities = { move: true, remove: true }; @@ -3732,7 +3751,7 @@ OO.ui.CapsuleItemWidget = function OoUiCapsuleItemWidget( config ) { // Events this.closeButton = new OO.ui.ButtonWidget( { framed: false, - indicator: 'clear', + icon: 'close', tabIndex: -1 } ).on( 'click', this.onCloseClick.bind( this ) ); @@ -4654,7 +4673,7 @@ OO.ui.TagItemWidget = function OoUiTagItemWidget( config ) { this.closeButton = new OO.ui.ButtonWidget( { framed: false, - indicator: 'clear', + icon: 'close', tabIndex: -1 } ); this.closeButton.setDisabled( this.isDisabled() ); @@ -5863,6 +5882,11 @@ OO.ui.MenuTagMultiselectWidget = function OoUiMenuTagMultiselectWidget( config ) .append( this.menu.$element ); this.$element .addClass( 'oo-ui-menuTagMultiselectWidget' ); + // TagMultiselectWidget already does this, but it doesn't work right because this.menu is not yet + // set up while the parent constructor runs, and #getAllowedValues rejects everything. + if ( config.selected ) { + this.setValue( config.selected ); + } }; /* Initialization */ @@ -5939,6 +5963,7 @@ OO.ui.MenuTagMultiselectWidget.prototype.onTagSelect = function ( tagItem ) { */ OO.ui.MenuTagMultiselectWidget.prototype.addTagFromInput = function () { var inputValue = this.input.getValue(), + validated = false, highlightedItem = this.menu.getHighlightedItem(), item = this.menu.getItemFromData( inputValue ); @@ -5947,14 +5972,19 @@ OO.ui.MenuTagMultiselectWidget.prototype.addTagFromInput = function () { // Look for a highlighted item first if ( highlightedItem ) { - this.addTag( highlightedItem.getData(), highlightedItem.getLabel() ); + validated = this.addTag( highlightedItem.getData(), highlightedItem.getLabel() ); } else if ( item ) { // Look for the element that fits the data - this.addTag( item.getData(), item.getLabel() ); + validated = this.addTag( item.getData(), item.getLabel() ); } else { // Otherwise, add the tag - the method will only add if the // tag is valid or if invalid tags are allowed - this.addTag( inputValue ); + validated = this.addTag( inputValue ); + } + + if ( validated ) { + this.clearInput(); + this.focus(); } }; @@ -6025,9 +6055,13 @@ OO.ui.MenuTagMultiselectWidget.prototype.getMenu = function () { * @return {string[]} Allowed data values */ OO.ui.MenuTagMultiselectWidget.prototype.getAllowedValues = function () { - var menuDatas = this.menu.getItems().map( function ( menuItem ) { - return menuItem.getData(); - } ); + var menuDatas = []; + if ( this.menu ) { + // If the parent constructor is calling us, we're not ready yet, this.menu is not set up. + menuDatas = this.menu.getItems().map( function ( menuItem ) { + return menuItem.getData(); + } ); + } return this.allowedValues.concat( menuDatas ); }; @@ -6243,6 +6277,13 @@ OO.ui.SelectFileWidget.prototype.blur = function () { return this; }; +/** + * @inheritdoc + */ +OO.ui.SelectFileWidget.prototype.simulateLabelClick = function () { + this.focus(); +}; + /** * Update the user interface when a file is selected or unselected * @@ -6734,7 +6775,7 @@ OO.ui.NumberInputWidget = function OoUiNumberInputWidget( config ) { disabled: this.isDisabled(), tabIndex: -1, classes: [ 'oo-ui-numberInputWidget-minusButton' ], - label: '−' + icon: 'subtract' }, config.minusButton ) ); @@ -6743,7 +6784,7 @@ OO.ui.NumberInputWidget = function OoUiNumberInputWidget( config ) { disabled: this.isDisabled(), tabIndex: -1, classes: [ 'oo-ui-numberInputWidget-plusButton' ], - label: '+' + icon: 'add' }, config.plusButton ) );