/*!
- * OOUI v0.30.2
+ * OOUI v0.30.3
* https://www.mediawiki.org/wiki/OOUI
*
* Copyright 2011–2019 OOUI Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2019-01-23T01:14:20Z
+ * Date: 2019-02-21T10:57:07Z
*/
( function ( OO ) {
config = config || {};
// Properties
- this.$ = $;
+ this.$ = function () {
+ OO.ui.warnDeprecation( 'this.$ is deprecated, use global $ instead' );
+ return $.apply( this, arguments );
+ };
this.elementId = null;
this.visible = true;
this.data = config.data;
function test() {
var $definer = $( '<div>' ).attr( {
dir: 'rtl',
- style: 'font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;'
- } ).text( 'A' ),
+ style: 'font-size: 14px; width: 4px; height: 1px; position: absolute; top: -1000px; overflow: scroll;'
+ } ).text( 'ABCD' ),
definer = $definer[ 0 ];
$definer.appendTo( 'body' );
*/
OO.ui.mixin.TabIndexedElement.prototype.focus = function () {
if ( !this.isDisabled() ) {
- this.$tabIndexed.focus();
+ this.$tabIndexed.trigger( 'focus' );
}
return this;
};
* @return {OO.ui.Element} The element, for chaining
*/
OO.ui.mixin.TabIndexedElement.prototype.blur = function () {
- this.$tabIndexed.blur();
+ this.$tabIndexed.trigger( 'blur' );
return this;
};
}
if ( event.target !== this.$element[ 0 ] ) {
- this.$focusOwner.focus();
+ this.$focusOwner.trigger( 'focus' );
}
};
* @cfg {boolean} [hideOnChoose=true] Hide the menu when the user chooses an option.
* @cfg {boolean} [filterFromInput=false] Filter the displayed options from the input
* @cfg {boolean} [highlightOnFilter] Highlight the first result when filtering
- * @cfg {number} [width] Width of the menu
+ * @param {number|string} [width] Width of the menu as a number of pixels or CSS string with unit suffix,
+ * used by {@link OO.ui.mixin.ClippableElement ClippableElement}
*/
OO.ui.MenuSelectWidget = function OoUiMenuSelectWidget( config ) {
// Configuration initialization
* with OO.ui.SelectWidget to create a selection of mutually exclusive options. For more information
* and examples, please see the [OOUI documentation on MediaWiki][1].
*
- * [1]: https://www.mediawiki.org/wiki/OOUI/Widgets/Selects_and_Multioptions
+ * [1]: https://www.mediawiki.org/wiki/OOUI/Widgets/Selects_and_Options
*
* @class
* @extends OO.ui.Widget
*/
OO.ui.CheckboxInputWidget.prototype.simulateLabelClick = function () {
if ( !this.isDisabled() ) {
- this.$input.click();
+ this.$handle.trigger( 'click' );
}
this.focus();
};
*/
OO.ui.RadioInputWidget.prototype.simulateLabelClick = function () {
if ( !this.isDisabled() ) {
- this.$input.click();
+ this.$input.trigger( 'click' );
}
this.focus();
};
};
/**
- * @inheritdoc
+ * Update the disabled state of the controls
+ *
+ * @chainable
+ * @protected
+ * @return {OO.ui.ComboBoxInputWidget} The widget, for chaining
*/
-OO.ui.ComboBoxInputWidget.prototype.setDisabled = function ( disabled ) {
- // Parent method
- OO.ui.ComboBoxInputWidget.parent.prototype.setDisabled.call( this, disabled );
-
+OO.ui.ComboBoxInputWidget.prototype.updateControlsDisabled = function () {
+ var disabled = this.isDisabled() || this.isReadOnly();
if ( this.dropdownButton ) {
- this.dropdownButton.setDisabled( this.isDisabled() );
+ this.dropdownButton.setDisabled( disabled );
}
if ( this.menu ) {
- this.menu.setDisabled( this.isDisabled() );
+ this.menu.setDisabled( disabled );
}
+ return this;
+};
+/**
+ * @inheritdoc
+ */
+OO.ui.ComboBoxInputWidget.prototype.setDisabled = function () {
+ // Parent method
+ OO.ui.ComboBoxInputWidget.parent.prototype.setDisabled.apply( this, arguments );
+ this.updateControlsDisabled();
+ return this;
+};
+
+/**
+ * @inheritdoc
+ */
+OO.ui.ComboBoxInputWidget.prototype.setReadOnly = function () {
+ // Parent method
+ OO.ui.ComboBoxInputWidget.parent.prototype.setReadOnly.apply( this, arguments );
+ this.updateControlsDisabled();
return this;
};