Merge "Add support for PHP7 random_bytes in favor of mcrypt_create_iv"
[lhc/web/wiklou.git] / resources / lib / oojs-ui / oojs-ui-toolbars.js
index 422704b..1574f6c 100644 (file)
@@ -1,12 +1,12 @@
 /*!
- * OOjs UI v0.18.4
+ * OOjs UI v0.19.5
  * 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-01-18T00:07:07Z
+ * Date: 2017-03-07T22:57:01Z
  */
 ( function ( OO ) {
 
  * @cfg {boolean} [actions] Add an actions section to the toolbar. Actions are commands that are included
  *  in the toolbar, but are not configured as tools. By default, actions are displayed on the right side of
  *  the toolbar.
- * @cfg {boolean} [shadow] Add a shadow below the toolbar.
+ * @cfg {string} [position='top'] Whether the toolbar is positioned above ('top') or below ('bottom') content.
  */
 OO.ui.Toolbar = function OoUiToolbar( toolFactory, toolGroupFactory, config ) {
        // Allow passing positional parameters inside the config object
@@ -317,6 +317,7 @@ OO.ui.Toolbar = function OoUiToolbar( toolFactory, toolGroupFactory, config ) {
        this.toolGroupFactory = toolGroupFactory;
        this.groups = [];
        this.tools = {};
+       this.position = config.position || 'top';
        this.$bar = $( '<div>' );
        this.$actions = $( '<div>' );
        this.initialized = false;
@@ -336,10 +337,7 @@ OO.ui.Toolbar = function OoUiToolbar( toolFactory, toolGroupFactory, config ) {
        this.$bar
                .addClass( 'oo-ui-toolbar-bar' )
                .append( this.$group, '<div style="clear:both"></div>' );
-       if ( config.shadow ) {
-               this.$bar.append( '<div class="oo-ui-toolbar-shadow"></div>' );
-       }
-       this.$element.addClass( 'oo-ui-toolbar' ).append( this.$bar );
+       this.$element.addClass( 'oo-ui-toolbar oo-ui-toolbar-position-' + this.position ).append( this.$bar );
 };
 
 /* Setup */
@@ -795,10 +793,10 @@ OO.ui.Tool.prototype.setActive = function ( state ) {
        this.active = !!state;
        if ( this.active ) {
                this.$element.addClass( 'oo-ui-tool-active' );
-               this.setFlags( 'progressive' );
+               this.setFlags( { progressive: true } );
        } else {
                this.$element.removeClass( 'oo-ui-tool-active' );
-               this.clearFlags();
+               this.setFlags( { progressive: false } );
        }
 };
 
@@ -993,6 +991,14 @@ OO.ui.ToolGroup.static.accelTooltips = false;
  */
 OO.ui.ToolGroup.static.autoDisable = true;
 
+/**
+ * @abstract
+ * @static
+ * @inheritable
+ * @property {string}
+ */
+OO.ui.ToolGroup.static.name = null;
+
 /* Methods */
 
 /**
@@ -1463,6 +1469,7 @@ OO.ui.PopupTool = function OoUiPopupTool( toolGroup, config ) {
        OO.ui.mixin.PopupElement.call( this, config );
 
        // Initialization
+       this.popup.setPosition( toolGroup.getToolbar().position === 'bottom' ? 'above' : 'below' );
        this.$element
                .addClass( 'oo-ui-popupTool' )
                .append( this.popup.$element );
@@ -1741,10 +1748,22 @@ OO.inheritClass( OO.ui.BarToolGroup, OO.ui.ToolGroup );
 
 /* Static Properties */
 
+/**
+ * @static
+ * @inheritdoc
+ */
 OO.ui.BarToolGroup.static.titleTooltips = true;
 
+/**
+ * @static
+ * @inheritdoc
+ */
 OO.ui.BarToolGroup.static.accelTooltips = true;
 
+/**
+ * @static
+ * @inheritdoc
+ */
 OO.ui.BarToolGroup.static.name = 'bar';
 
 /**
@@ -1775,7 +1794,9 @@ OO.ui.PopupToolGroup = function OoUiPopupToolGroup( toolbar, config ) {
        }
 
        // Configuration initialization
-       config = config || {};
+       config = $.extend( {
+               indicator: toolbar.position === 'bottom' ? 'up' : 'down'
+       }, config );
 
        // Parent constructor
        OO.ui.PopupToolGroup.parent.call( this, toolbar, config );
@@ -2010,7 +2031,6 @@ OO.ui.PopupToolGroup.prototype.setActive = function ( value ) {
  *             // Configurations for list toolgroup.
  *             type: 'list',
  *             label: 'ListToolGroup',
- *             indicator: 'down',
  *             icon: 'ellipsis',
  *             title: 'This is the title, displayed when user moves the mouse over the list toolgroup',
  *             header: 'This is the header',
@@ -2081,6 +2101,10 @@ OO.inheritClass( OO.ui.ListToolGroup, OO.ui.PopupToolGroup );
 
 /* Static Properties */
 
+/**
+ * @static
+ * @inheritdoc
+ */
 OO.ui.ListToolGroup.static.name = 'list';
 
 /* Methods */
@@ -2171,6 +2195,9 @@ OO.ui.ListToolGroup.prototype.updateCollapsibleState = function () {
        for ( i = 0, len = this.collapsibleTools.length; i < len; i++ ) {
                this.collapsibleTools[ i ].toggle( this.expanded );
        }
+
+       // Re-evaluate clipping, because our height has changed
+       this.clip();
 };
 
 /**
@@ -2240,7 +2267,6 @@ OO.ui.ListToolGroup.prototype.updateCollapsibleState = function () {
  *             type: 'menu',
  *             header: 'This is the (optional) header',
  *             title: 'This is the (optional) title',
- *             indicator: 'down',
  *             include: [ 'settings', 'stuff' ]
  *         }
  *     ] );
@@ -2303,6 +2329,10 @@ OO.inheritClass( OO.ui.MenuToolGroup, OO.ui.PopupToolGroup );
 
 /* Static Properties */
 
+/**
+ * @static
+ * @inheritdoc
+ */
 OO.ui.MenuToolGroup.static.name = 'menu';
 
 /* Methods */