Update OOjs UI to v0.16.4
[lhc/web/wiklou.git] / resources / lib / oojs-ui / oojs-ui-widgets.js
index c7a4555..abb2b1b 100644 (file)
@@ -1,12 +1,12 @@
 /*!
- * OOjs UI v0.16.3
+ * OOjs UI v0.16.4
  * https://www.mediawiki.org/wiki/OOjs_UI
  *
  * Copyright 2011–2016 OOjs UI Team and other contributors.
  * Released under the MIT license
  * http://oojs.mit-license.org
  *
- * Date: 2016-03-16T19:20:22Z
+ * Date: 2016-03-22T22:48:21Z
  */
 ( function ( OO ) {
 
@@ -5048,6 +5048,7 @@ OO.ui.SearchWidget.prototype.getResults = function () {
  * @cfg {number} [max=Infinity] Maximum allowed value
  * @cfg {number} [step=1] Delta when using the buttons or up/down arrow keys
  * @cfg {number|null} [pageStep] Delta when using the page-up/page-down keys. Defaults to 10 times #step.
+ * @cfg {boolean} [showButtons=true] Whether to show the plus and minus buttons.
  */
 OO.ui.NumberInputWidget = function OoUiNumberInputWidget( config ) {
        // Configuration initialization
@@ -5056,7 +5057,8 @@ OO.ui.NumberInputWidget = function OoUiNumberInputWidget( config ) {
                min: -Infinity,
                max: Infinity,
                step: 1,
-               pageStep: null
+               pageStep: null,
+               showButtons: true
        }, config );
 
        // Parent constructor
@@ -5069,28 +5071,30 @@ OO.ui.NumberInputWidget = function OoUiNumberInputWidget( config ) {
                },
                config.input
        ) );
-       this.minusButton = new OO.ui.ButtonWidget( $.extend(
-               {
-                       disabled: this.isDisabled(),
-                       tabIndex: -1
-               },
-               config.minusButton,
-               {
-                       classes: [ 'oo-ui-numberInputWidget-minusButton' ],
-                       label: '−'
-               }
-       ) );
-       this.plusButton = new OO.ui.ButtonWidget( $.extend(
-               {
-                       disabled: this.isDisabled(),
-                       tabIndex: -1
-               },
-               config.plusButton,
-               {
-                       classes: [ 'oo-ui-numberInputWidget-plusButton' ],
-                       label: '+'
-               }
-       ) );
+       if ( config.showButtons ) {
+               this.minusButton = new OO.ui.ButtonWidget( $.extend(
+                       {
+                               disabled: this.isDisabled(),
+                               tabIndex: -1
+                       },
+                       config.minusButton,
+                       {
+                               classes: [ 'oo-ui-numberInputWidget-minusButton' ],
+                               label: '−'
+                       }
+               ) );
+               this.plusButton = new OO.ui.ButtonWidget( $.extend(
+                       {
+                               disabled: this.isDisabled(),
+                               tabIndex: -1
+                       },
+                       config.plusButton,
+                       {
+                               classes: [ 'oo-ui-numberInputWidget-plusButton' ],
+                               label: '+'
+                       }
+               ) );
+       }
 
        // Events
        this.input.connect( this, {
@@ -5101,12 +5105,14 @@ OO.ui.NumberInputWidget = function OoUiNumberInputWidget( config ) {
                keydown: this.onKeyDown.bind( this ),
                'wheel mousewheel DOMMouseScroll': this.onWheel.bind( this )
        } );
-       this.plusButton.connect( this, {
-               click: [ 'onButtonClick', +1 ]
-       } );
-       this.minusButton.connect( this, {
-               click: [ 'onButtonClick', -1 ]
-       } );
+       if ( config.showButtons ) {
+               this.plusButton.connect( this, {
+                       click: [ 'onButtonClick', +1 ]
+               } );
+               this.minusButton.connect( this, {
+                       click: [ 'onButtonClick', -1 ]
+               } );
+       }
 
        // Initialization
        this.setIsInteger( !!config.isInteger );
@@ -5114,12 +5120,14 @@ OO.ui.NumberInputWidget = function OoUiNumberInputWidget( config ) {
        this.setStep( config.step, config.pageStep );
 
        this.$field = $( '<div>' ).addClass( 'oo-ui-numberInputWidget-field' )
-               .append(
-                       this.minusButton.$element,
-                       this.input.$element,
-                       this.plusButton.$element
-               );
+               .append( this.input.$element );
        this.$element.addClass( 'oo-ui-numberInputWidget' ).append( this.$field );
+       if ( config.showButtons ) {
+               this.$field
+                       .prepend( this.minusButton.$element )
+                       .append( this.plusButton.$element );
+               this.$element.addClass( 'oo-ui-numberInputWidget-buttoned' );
+       }
        this.input.setValidation( this.validateNumber.bind( this ) );
 };