/*!
- * OOUI v0.26.5
+ * OOUI v0.27.4
* https://www.mediawiki.org/wiki/OOUI
*
* Copyright 2011–2018 OOUI Team and other contributors.
* Released under the MIT license
* http://oojs.mit-license.org
*
- * Date: 2018-04-24T23:29:01Z
+ * Date: 2018-06-27T17:25:08Z
*/
( function ( OO ) {
// Initialization
this.$element
.addClass( 'oo-ui-windowManager' )
- .attr( 'aria-hidden', true )
.toggleClass( 'oo-ui-windowManager-modal', this.modal );
+ if ( this.modal ) {
+ this.$element.attr( 'aria-hidden', true );
+ }
};
/* Setup */
this.detachActions();
if ( !this.isClosing() ) {
this.attachActions();
+ if ( !this.isOpening() ) {
+ // If the dialog is currently opening, this will be called automatically soon.
+ this.updateSize();
+ }
}
};
OO.ui.Dialog.prototype.getActionWidgets = function ( actions ) {
var i, len, widgets = [];
for ( i = 0, len = actions.length; i < len; i++ ) {
- widgets.push(
- new OO.ui.ActionWidget( actions[ i ] )
- );
+ widgets.push( this.getActionWidget( actions[ i ] ) );
}
return widgets;
};
+/**
+ * Get action widget from config
+ *
+ * Override this method to change the action widget class used.
+ *
+ * @param {Object} config Action widget config
+ * @return {OO.ui.ActionWidget} Action widget
+ */
+OO.ui.Dialog.prototype.getActionWidget = function ( config ) {
+ return new OO.ui.ActionWidget( this.getActionWidgetConfig( config ) );
+};
+
+/**
+ * Get action widget config
+ *
+ * Override this method to modify the action widget config
+ *
+ * @param {Object} config Initial action widget config
+ * @return {Object} Action widget config
+ */
+OO.ui.Dialog.prototype.getActionWidgetConfig = function ( config ) {
+ return config;
+};
+
/**
* Attach action actions.
*
/* Methods */
-/**
- * @inheritdoc
- */
-OO.ui.MessageDialog.prototype.setManager = function ( manager ) {
- OO.ui.MessageDialog.parent.prototype.setManager.call( this, manager );
-
- // Events
- this.manager.connect( this, {
- resize: 'onResize'
- } );
-
- return this;
-};
-
-/**
- * Handle window resized events.
- *
- * @private
- */
-OO.ui.MessageDialog.prototype.onResize = function () {
- var dialog = this;
- dialog.fitActions();
- // Wait for CSS transition to finish and do it again :(
- setTimeout( function () {
- dialog.fitActions();
- }, 300 );
-};
-
/**
* Toggle action layout between vertical and horizontal.
*
* @inheritdoc
*/
OO.ui.MessageDialog.prototype.setDimensions = function ( dim ) {
- var $scrollable = this.container.$element;
+ var
+ dialog = this,
+ $scrollable = this.container.$element;
OO.ui.MessageDialog.parent.prototype.setDimensions.call( this, dim );
// Twiddle the overflow property, otherwise an unnecessary scrollbar will be produced.
$scrollable[ 0 ].style.overflow = oldOverflow;
}, 300 );
+ dialog.fitActions();
+ // Wait for CSS transition to finish and do it again :(
+ setTimeout( function () {
+ dialog.fitActions();
+ }, 300 );
+
return this;
};
this.$foot.append( this.$actions );
};
+/**
+ * @inheritdoc
+ */
+OO.ui.MessageDialog.prototype.getActionWidgetConfig = function ( config ) {
+ // Force unframed
+ return $.extend( {}, config, { framed: false } );
+};
+
/**
* @inheritdoc
*/
OO.ui.MessageDialog.prototype.attachActions = function () {
- var i, len, other, special, others;
+ var i, len, special, others;
// Parent method
OO.ui.MessageDialog.parent.prototype.attachActions.call( this );
if ( special.safe ) {
this.$actions.append( special.safe.$element );
- special.safe.toggleFramed( false );
}
- if ( others.length ) {
- for ( i = 0, len = others.length; i < len; i++ ) {
- other = others[ i ];
- this.$actions.append( other.$element );
- other.toggleFramed( false );
- }
+ for ( i = 0, len = others.length; i < len; i++ ) {
+ this.$actions.append( others[ i ].$element );
}
if ( special.primary ) {
this.$actions.append( special.primary.$element );
- special.primary.toggleFramed( false );
- }
-
- if ( !this.isOpening() ) {
- // If the dialog is currently opening, this will be called automatically soon.
- // This also calls #fitActions.
- this.updateSize();
}
};
/**
* @inheritdoc
*/
-OO.ui.ProcessDialog.prototype.getActionWidgets = function ( actions ) {
- var i, len, config,
- isMobile = OO.ui.isMobile(),
- widgets = [];
-
- for ( i = 0, len = actions.length; i < len; i++ ) {
- config = $.extend( { framed: !OO.ui.isMobile() }, actions[ i ] );
- if ( isMobile &&
- ( config.flags === 'back' || ( Array.isArray( config.flags ) && config.flags.indexOf( 'back' ) !== -1 ) )
- ) {
- $.extend( config, {
- icon: 'previous',
- label: ''
- } );
- }
- widgets.push(
- new OO.ui.ActionWidget( config )
- );
+OO.ui.ProcessDialog.prototype.getActionWidgetConfig = function ( config ) {
+ var isMobile = OO.ui.isMobile();
+
+ // Default to unframed on mobile
+ config = $.extend( { framed: !isMobile }, config );
+ // Change back buttons to icon only on mobile
+ if (
+ isMobile &&
+ ( config.flags === 'back' || ( Array.isArray( config.flags ) && config.flags.indexOf( 'back' ) !== -1 ) )
+ ) {
+ $.extend( config, {
+ icon: 'previous',
+ label: ''
+ } );
}
- return widgets;
+
+ return config;
};
/**
if ( special.safe ) {
this.$safeActions.append( special.safe.$element );
}
-
- this.fitLabel();
- this.$body.css( 'bottom', this.$foot.outerHeight( true ) );
};
/**
* @inheritdoc
*/
OO.ui.ProcessDialog.prototype.setDimensions = function () {
+ var dialog = this;
+
// Parent method
OO.ui.ProcessDialog.parent.prototype.setDimensions.apply( this, arguments );
this.fitLabel();
+
+ // If there are many actions, they might be shown on multiple lines. Their layout can change when
+ // resizing the dialog and when changing the actions. Adjust the height of the footer to fit them.
+ dialog.$body.css( 'bottom', dialog.$foot.outerHeight( true ) );
+ // Wait for CSS transition to finish and do it again :(
+ setTimeout( function () {
+ dialog.$body.css( 'bottom', dialog.$foot.outerHeight( true ) );
+ }, 300 );
};
/**
}( OO ) );
-//# sourceMappingURL=oojs-ui-windows.js.map
\ No newline at end of file
+//# sourceMappingURL=oojs-ui-windows.js.map.json
\ No newline at end of file