/*!
- * OOUI v0.27.3
+ * OOUI v0.27.6
* 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-06-07T21:36:30Z
+ * Date: 2018-08-01T22:17:59Z
*/
( 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 */
* @return {number} Milliseconds to wait
*/
OO.ui.WindowManager.prototype.getReadyDelay = function () {
- return 0;
+ return this.modal ? OO.ui.theme.getDialogTransitionDuration() : 0;
};
/**
* @return {number} Milliseconds to wait
*/
OO.ui.WindowManager.prototype.getTeardownDelay = function () {
- return this.modal ? 250 : 0;
+ return this.modal ? OO.ui.theme.getDialogTransitionDuration() : 0;
};
/**
setTimeout( function () {
manager.compatOpened = $.Deferred();
win.setup( data ).then( function () {
- manager.updateWindowSize( win );
compatOpening.notify( { state: 'setup' } );
setTimeout( function () {
win.ready( data ).then( function () {
/**
* Get the 'setup' process.
*
- * The setup process is used to set up a window for use in a particular context,
- * based on the `data` argument. This method is called during the opening phase of the window’s
- * lifecycle.
+ * The setup process is used to set up a window for use in a particular context, based on the `data`
+ * argument. This method is called during the opening phase of the window’s lifecycle (before the
+ * opening animation). You can add elements to the window in this process or set their default
+ * values.
*
* Override this method to add additional steps to the ‘setup’ process the parent method provides
* using the {@link OO.ui.Process#first first} and {@link OO.ui.Process#next next} methods
/**
* Get the ‘ready’ process.
*
- * The ready process is used to ready a window for use in a particular
- * context, based on the `data` argument. This method is called during the opening phase of
- * the window’s lifecycle, after the window has been {@link #getSetupProcess setup}.
+ * The ready process is used to ready a window for use in a particular context, based on the `data`
+ * argument. This method is called during the opening phase of the window’s lifecycle, after the
+ * window has been {@link #getSetupProcess setup} (after the opening animation). You can focus
+ * elements in the window in this process, or open their dropdowns.
*
* Override this method to add additional steps to the ‘ready’ process the parent method
* provides using the {@link OO.ui.Process#first first} and {@link OO.ui.Process#next next}
/**
* Get the 'hold' process.
*
- * The hold process is used to keep a window from being used in a particular context,
- * based on the `data` argument. This method is called during the closing phase of the window’s
- * lifecycle.
+ * The hold process is used to keep a window from being used in a particular context, based on the
+ * `data` argument. This method is called during the closing phase of the window’s lifecycle (before
+ * the closing animation). You can close dropdowns of elements in the window in this process, if
+ * they do not get closed automatically.
*
* Override this method to add additional steps to the 'hold' process the parent method provides
* using the {@link OO.ui.Process#first first} and {@link OO.ui.Process#next next} methods
/**
* Get the ‘teardown’ process.
*
- * The teardown process is used to teardown a window after use. During teardown,
- * user interactions within the window are conveyed and the window is closed, based on the `data`
- * argument. This method is called during the closing phase of the window’s lifecycle.
+ * The teardown process is used to teardown a window after use. During teardown, user interactions
+ * within the window are conveyed and the window is closed, based on the `data` argument. This
+ * method is called during the closing phase of the window’s lifecycle (after the closing
+ * animation). You can remove elements in the window in this process or clear their values.
*
* Override this method to add additional steps to the ‘teardown’ process the parent method provides
* using the {@link OO.ui.Process#first first} and {@link OO.ui.Process#next next} methods
/**
* Setup window.
*
- * This is called by OO.ui.WindowManager during window opening, and should not be called directly
- * by other systems.
+ * This is called by OO.ui.WindowManager during window opening (before the animation), and should
+ * not be called directly by other systems.
*
* @param {Object} [data] Window opening data
* @return {jQuery.Promise} Promise resolved when window is setup
this.$focusTraps.on( 'focus', this.focusTrapHandler );
return this.getSetupProcess( data ).execute().then( function () {
+ win.updateSize();
// Force redraw by asking the browser to measure the elements' widths
win.$element.addClass( 'oo-ui-window-active oo-ui-window-setup' ).width();
win.$content.addClass( 'oo-ui-window-content-setup' ).width();
/**
* Ready window.
*
- * This is called by OO.ui.WindowManager during window opening, and should not be called directly
- * by other systems.
+ * This is called by OO.ui.WindowManager during window opening (after the animation), and should not
+ * be called directly by other systems.
*
* @param {Object} [data] Window opening data
* @return {jQuery.Promise} Promise resolved when window is ready
/**
* Hold window.
*
- * This is called by OO.ui.WindowManager during window closing, and should not be called directly
- * by other systems.
+ * This is called by OO.ui.WindowManager during window closing (before the animation), and should
+ * not be called directly by other systems.
*
* @param {Object} [data] Window closing data
* @return {jQuery.Promise} Promise resolved when window is held
}
// Force redraw by asking the browser to measure the elements' widths
- win.$element.removeClass( 'oo-ui-window-ready' ).width();
- win.$content.removeClass( 'oo-ui-window-content-ready' ).width();
+ win.$element.removeClass( 'oo-ui-window-ready oo-ui-window-setup' ).width();
+ win.$content.removeClass( 'oo-ui-window-content-ready oo-ui-window-content-setup' ).width();
} );
};
/**
* Teardown window.
*
- * This is called by OO.ui.WindowManager during window closing, and should not be called directly
+ * This is called by OO.ui.WindowManager during window closing (after the animation), and should not be called directly
* by other systems.
*
* @param {Object} [data] Window closing data
return this.getTeardownProcess( data ).execute().then( function () {
// Force redraw by asking the browser to measure the elements' widths
- win.$element.removeClass( 'oo-ui-window-active oo-ui-window-setup' ).width();
- win.$content.removeClass( 'oo-ui-window-content-setup' ).width();
+ win.$element.removeClass( 'oo-ui-window-active' ).width();
+
win.$focusTraps.off( 'focus', win.focusTrapHandler );
win.toggle( false );
} );
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.
*
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 );
+ special.safe.toggleFramed( true );
}
- 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 );
+ others[ i ].toggleFramed( true );
}
if ( special.primary ) {
this.$actions.append( special.primary.$element );
- special.primary.toggleFramed( false );
+ special.primary.toggleFramed( true );
}
};
this.toggleVerticalActionLayout( false );
for ( i = 0, len = actions.length; i < len; i++ ) {
action = actions[ i ];
- if ( action.$element.innerWidth() < action.$label.outerWidth( true ) ) {
+ if ( action.$element[ 0 ].scrollWidth > action.$element[ 0 ].clientWidth ) {
this.toggleVerticalActionLayout( true );
break;
}
/**
* @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;
};
/**