/*!
- * OOjs UI v0.21.4
+ * OOjs UI v0.22.4
* 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-08-03T19:36:51Z
*/
( function ( OO ) {
}
this.$element
.addClass( 'oo-ui-draggableGroupElement' )
- .attr( 'role', 'listbox' )
.append( this.$status )
.toggleClass( 'oo-ui-draggableGroupElement-horizontal', this.orientation === 'horizontal' );
};
* @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;
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.
} );
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 };
// Events
this.closeButton = new OO.ui.ButtonWidget( {
framed: false,
- indicator: 'clear',
+ icon: 'close',
tabIndex: -1
} ).on( 'click', this.onCloseClick.bind( this ) );
this.closeButton = new OO.ui.ButtonWidget( {
framed: false,
- indicator: 'clear',
+ icon: 'close',
tabIndex: -1
} );
this.closeButton.setDisabled( this.isDisabled() );
OO.ui.TagMultiselectWidget.prototype.updateInputSize = function () {
var $lastItem, direction, contentWidth, currentWidth, bestWidth;
if ( this.inputPosition === 'inline' && !this.isDisabled() ) {
+ if ( this.input.$input[ 0 ].scrollWidth === 0 ) {
+ // Input appears to be attached but not visible.
+ // Don't attempt to adjust its size, because our measurements
+ // are going to fail anyway.
+ return;
+ }
this.input.$input.css( 'width', '1em' );
$lastItem = this.$group.children().last();
direction = OO.ui.Element.static.getDir( this.$handle );
.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 */
*/
OO.ui.MenuTagMultiselectWidget.prototype.addTagFromInput = function () {
var inputValue = this.input.getValue(),
+ validated = false,
highlightedItem = this.menu.getHighlightedItem(),
item = this.menu.getItemFromData( inputValue );
// 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();
}
};
* @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 );
};
return this;
};
+/**
+ * @inheritdoc
+ */
+OO.ui.SelectFileWidget.prototype.simulateLabelClick = function () {
+ this.focus();
+};
+
/**
* Update the user interface when a file is selected or unselected
*
disabled: this.isDisabled(),
tabIndex: -1,
classes: [ 'oo-ui-numberInputWidget-minusButton' ],
- label: '−'
+ icon: 'subtract'
},
config.minusButton
) );
disabled: this.isDisabled(),
tabIndex: -1,
classes: [ 'oo-ui-numberInputWidget-plusButton' ],
- label: '+'
+ icon: 'add'
},
config.plusButton
) );