/*!
- * OOjs UI v0.21.4
+ * OOjs UI v0.22.1
* 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-05-31T19:07:36Z
*/
( function ( OO ) {
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.
.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
) );