Jforrester has uploaded a new change for review. https://gerrit.wikimedia.org/r/188022
Change subject: Update OOjs UI to v0.6.5 ...................................................................... Update OOjs UI to v0.6.5 Release notes: https://git.wikimedia.org/blob/oojs%2Fui.git/v0.6.5/History.md Change-Id: I1278a9d0f3b63977f293a79c73283593c65bf910 --- M composer.json M composer.lock M composer/installed.json M oojs/oojs-ui/History.md M oojs/oojs-ui/build/modules.json M oojs/oojs-ui/demos/pages/dialogs.js M oojs/oojs-ui/package.json M oojs/oojs-ui/src/elements/ButtonElement.js M oojs/oojs-ui/src/layouts/BookletLayout.js M oojs/oojs-ui/src/widgets/ButtonWidget.js 10 files changed, 128 insertions(+), 39 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/vendor refs/changes/22/188022/1 diff --git a/composer.json b/composer.json index 979538d..0ca4bc0 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ "monolog/monolog": "1.11.0", "Plancake/EmailParser": "dev-master#e7453ead1f3a74810d8050a30afb96feed74477a", "ruflin/elastica": "1.3.0.0", - "oojs/oojs-ui": "0.6.4", + "oojs/oojs-ui": "0.6.5", "wikimedia/cdb": "1.0.1", "wikimedia/composer-merge-plugin": "0.5.0", "zordius/lightncandy": "0.18" diff --git a/composer.lock b/composer.lock index a38bf16..e5f8ce2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "b5e89a90deda7732d0d3173052f2e51a", + "hash": "09659d4d0c3e6326e76575425744ccae", "packages": [ { "name": "Plancake/EmailParser", @@ -200,16 +200,16 @@ }, { "name": "oojs/oojs-ui", - "version": "v0.6.4", + "version": "v0.6.5", "source": { "type": "git", "url": "https://github.com/wikimedia/oojs-ui.git", - "reference": "73ff43735d6997ef4ba9320a1dde2f4de37cc7f6" + "reference": "57b2cc74b44c9efa7a262d30ef1cfdb935fa6138" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/oojs-ui/zipball/73ff43735d6997ef4ba9320a1dde2f4de37cc7f6", - "reference": "73ff43735d6997ef4ba9320a1dde2f4de37cc7f6", + "url": "https://api.github.com/repos/wikimedia/oojs-ui/zipball/57b2cc74b44c9efa7a262d30ef1cfdb935fa6138", + "reference": "57b2cc74b44c9efa7a262d30ef1cfdb935fa6138", "shasum": "" }, "require": { @@ -226,7 +226,7 @@ "MIT" ], "homepage": "https://www.mediawiki.org/wiki/OOjs_UI", - "time": "2015-01-31 01:12:58" + "time": "2015-02-02 02:41:40" }, { "name": "psr/log", diff --git a/composer/installed.json b/composer/installed.json index 66fcc94..64ebbaa 100644 --- a/composer/installed.json +++ b/composer/installed.json @@ -440,23 +440,23 @@ }, { "name": "oojs/oojs-ui", - "version": "v0.6.4", - "version_normalized": "0.6.4.0", + "version": "v0.6.5", + "version_normalized": "0.6.5.0", "source": { "type": "git", "url": "https://github.com/wikimedia/oojs-ui.git", - "reference": "73ff43735d6997ef4ba9320a1dde2f4de37cc7f6" + "reference": "57b2cc74b44c9efa7a262d30ef1cfdb935fa6138" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wikimedia/oojs-ui/zipball/73ff43735d6997ef4ba9320a1dde2f4de37cc7f6", - "reference": "73ff43735d6997ef4ba9320a1dde2f4de37cc7f6", + "url": "https://api.github.com/repos/wikimedia/oojs-ui/zipball/57b2cc74b44c9efa7a262d30ef1cfdb935fa6138", + "reference": "57b2cc74b44c9efa7a262d30ef1cfdb935fa6138", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "time": "2015-01-31 01:12:58", + "time": "2015-02-02 02:41:40", "type": "library", "installation-source": "dist", "autoload": { diff --git a/oojs/oojs-ui/History.md b/oojs/oojs-ui/History.md index b674b74..1813495 100644 --- a/oojs/oojs-ui/History.md +++ b/oojs/oojs-ui/History.md @@ -1,5 +1,9 @@ # OOjs UI Release History +## v0.6.5 / 2014-02-01 +* Make BookletLayout inherit from MenuLayout instead of embedding a GridLayout (Ed Sanders) +* ButtonElement: Unbreak 'pressed' state (Bartosz Dziewoński) + ## v0.6.4 / 2014-01-30 * InputWidget: Resynchronize our internal .value with DOM .value in #getValue (eranroz) * demo: Remove nonexistent 'align' config option for a DropdownWidget (Bartosz Dziewoński) diff --git a/oojs/oojs-ui/build/modules.json b/oojs/oojs-ui/build/modules.json index b138704..d3d9df6 100644 --- a/oojs/oojs-ui/build/modules.json +++ b/oojs/oojs-ui/build/modules.json @@ -40,13 +40,13 @@ "src/dialogs/MessageDialog.js", "src/dialogs/ProcessDialog.js", - "src/layouts/BookletLayout.js", "src/layouts/FieldLayout.js", "src/layouts/ActionFieldLayout.js", "src/layouts/FieldsetLayout.js", "src/layouts/FormLayout.js", "src/layouts/GridLayout.js", "src/layouts/MenuLayout.js", + "src/layouts/BookletLayout.js", "src/layouts/PanelLayout.js", "src/layouts/PageLayout.js", "src/layouts/StackLayout.js", diff --git a/oojs/oojs-ui/demos/pages/dialogs.js b/oojs/oojs-ui/demos/pages/dialogs.js index 6414ac5..6483476 100644 --- a/oojs/oojs-ui/demos/pages/dialogs.js +++ b/oojs/oojs-ui/demos/pages/dialogs.js @@ -184,16 +184,48 @@ }; BookletDialog.prototype.initialize = function () { BookletDialog.super.prototype.initialize.apply( this, arguments ); - this.bookletLayout = new OO.ui.BookletLayout( { $: this.$, outlined: true } ); + + var dialog = this; + + function changePage( direction ) { + var pageIndex = dialog.pages.indexOf( dialog.bookletLayout.getCurrentPage() ); + pageIndex = ( dialog.pages.length + pageIndex + direction ) % dialog.pages.length; + dialog.bookletLayout.setPage( dialog.pages[ pageIndex ].getName() ); + } + + this.navigationField = new OO.ui.FieldLayout( + new OO.ui.ButtonGroupWidget( { + items: [ + new OO.ui.ButtonWidget( { + data: 'previous', + icon: 'previous' + } ).on( 'click', function () { + changePage( -1 ); + } ), + new OO.ui.ButtonWidget( { + data: 'next', + icon: 'next' + } ).on( 'click', function () { + changePage( 1 ); + } ) + ] + } ), + { + label: 'Change page', + align: 'top' + } + ); + + this.bookletLayout = new OO.ui.BookletLayout( { $: this.$ } ); this.pages = [ - new SamplePage( 'small', { $: this.$, label: 'Small', icon: 'window' } ), - new SamplePage( 'medium', { $: this.$, label: 'Medium', icon: 'window' } ), - new SamplePage( 'large', { $: this.$, label: 'Large', icon: 'window' } ), - new SamplePage( 'larger', { $: this.$, label: 'Larger', icon: 'window' } ), - new SamplePage( 'full', { $: this.$, label: 'Full', icon: 'window' } ) + new SamplePage( 'page-1', { $: this.$, label: 'Page 1', icon: 'window' } ), + new SamplePage( 'page-2', { $: this.$, label: 'Page 2', icon: 'window' } ), + new SamplePage( 'page-3', { $: this.$, label: 'Page 3', icon: 'window' } ) ]; this.bookletLayout.addPages( this.pages ); this.bookletLayout.connect( this, { set: 'onBookletLayoutSet' } ); + this.bookletLayout.setPage( 'page-1' ); + this.$body.append( this.bookletLayout.$element ); }; BookletDialog.prototype.getActionProcess = function ( action ) { @@ -205,10 +237,52 @@ return BookletDialog.super.prototype.getActionProcess.call( this, action ); }; BookletDialog.prototype.onBookletLayoutSet = function ( page ) { + page.$element.append( this.navigationField.$element ); + }; + + function OutlinedBookletDialog( config ) { + OutlinedBookletDialog.super.call( this, config ); + } + OO.inheritClass( OutlinedBookletDialog, OO.ui.ProcessDialog ); + OutlinedBookletDialog.static.title = 'Booklet dialog'; + OutlinedBookletDialog.static.actions = [ + { action: 'save', label: 'Done', flags: [ 'primary', 'progressive' ] }, + { action: 'cancel', label: 'Cancel', flags: 'safe' } + ]; + OutlinedBookletDialog.prototype.getBodyHeight = function () { + return 250; + }; + OutlinedBookletDialog.prototype.initialize = function () { + OutlinedBookletDialog.super.prototype.initialize.apply( this, arguments ); + this.bookletLayout = new OO.ui.BookletLayout( { + $: this.$, + outlined: true, + menuSize: '15em' + } ); + this.pages = [ + new SamplePage( 'small', { $: this.$, label: 'Small', icon: 'window' } ), + new SamplePage( 'medium', { $: this.$, label: 'Medium', icon: 'window' } ), + new SamplePage( 'large', { $: this.$, label: 'Large', icon: 'window' } ), + new SamplePage( 'larger', { $: this.$, label: 'Larger', icon: 'window' } ), + new SamplePage( 'full', { $: this.$, label: 'Full', icon: 'window' } ) + ]; + this.bookletLayout.addPages( this.pages ); + this.bookletLayout.connect( this, { set: 'onBookletLayoutSet' } ); + this.$body.append( this.bookletLayout.$element ); + }; + OutlinedBookletDialog.prototype.getActionProcess = function ( action ) { + if ( action ) { + return new OO.ui.Process( function () { + this.close( { action: action } ); + }, this ); + } + return OutlinedBookletDialog.super.prototype.getActionProcess.call( this, action ); + }; + OutlinedBookletDialog.prototype.onBookletLayoutSet = function ( page ) { this.setSize( page.getName() ); }; - BookletDialog.prototype.getSetupProcess = function ( data ) { - return BookletDialog.super.prototype.getSetupProcess.call( this, data ) + OutlinedBookletDialog.prototype.getSetupProcess = function ( data ) { + return OutlinedBookletDialog.super.prototype.getSetupProcess.call( this, data ) .next( function () { this.bookletLayout.setPage( this.getSize() ); }, this ); @@ -360,6 +434,13 @@ } }, { + name: 'Outlined booklet dialog', + dialogClass: OutlinedBookletDialog, + config: { + size: 'medium' + } + }, + { name: 'Menu dialog', dialogClass: MenuDialog, config: { diff --git a/oojs/oojs-ui/package.json b/oojs/oojs-ui/package.json index 4cb9b3a..6a9f080 100644 --- a/oojs/oojs-ui/package.json +++ b/oojs/oojs-ui/package.json @@ -1,6 +1,6 @@ { "name": "oojs-ui", - "version": "0.6.4", + "version": "0.6.5", "description": "User interface classes built on the OOjs framework.", "keywords": [ "oojs-plugin", diff --git a/oojs/oojs-ui/src/elements/ButtonElement.js b/oojs/oojs-ui/src/elements/ButtonElement.js index 6859cf2..5213a8c 100644 --- a/oojs/oojs-ui/src/elements/ButtonElement.js +++ b/oojs/oojs-ui/src/elements/ButtonElement.js @@ -80,6 +80,9 @@ return false; } this.$element.addClass( 'oo-ui-buttonElement-pressed' ); + // Run the mouseup handler no matter where the mouse is when the button is let go, so we can + // reliably remove the pressed class + this.getElementDocument().addEventListener( 'mouseup', this.onMouseUpHandler, true ); // Prevent change of focus unless specifically configured otherwise if ( this.constructor.static.cancelButtonMouseDownEvents ) { return false; @@ -96,6 +99,8 @@ return false; } this.$element.removeClass( 'oo-ui-buttonElement-pressed' ); + // Stop listening for mouseup, since we only needed this once + this.getElementDocument().removeEventListener( 'mouseup', this.onMouseUpHandler, true ); }; /** diff --git a/oojs/oojs-ui/src/layouts/BookletLayout.js b/oojs/oojs-ui/src/layouts/BookletLayout.js index 8bcb160..4284330 100644 --- a/oojs/oojs-ui/src/layouts/BookletLayout.js +++ b/oojs/oojs-ui/src/layouts/BookletLayout.js @@ -2,7 +2,7 @@ * Layout containing a series of pages. * * @class - * @extends OO.ui.Layout + * @extends OO.ui.MenuLayout * * @constructor * @param {Object} [config] Configuration options @@ -23,6 +23,7 @@ this.pages = {}; this.ignoreFocus = false; this.stackLayout = new OO.ui.StackLayout( { $: this.$, continuous: !!config.continuous } ); + this.$content.append( this.stackLayout.$element ); this.autoFocus = config.autoFocus === undefined || !!config.autoFocus; this.outlineVisible = false; this.outlined = !!config.outlined; @@ -31,10 +32,7 @@ this.outlineControlsWidget = null; this.outlineSelectWidget = new OO.ui.OutlineSelectWidget( { $: this.$ } ); this.outlinePanel = new OO.ui.PanelLayout( { $: this.$, scrollable: true } ); - this.gridLayout = new OO.ui.GridLayout( - [ this.outlinePanel, this.stackLayout ], - { $: this.$, widths: [ 1, 2 ] } - ); + this.$menu.append( this.outlinePanel.$element ); this.outlineVisible = true; if ( this.editable ) { this.outlineControlsWidget = new OO.ui.OutlineControlsWidget( @@ -42,6 +40,7 @@ ); } } + this.toggleMenu( this.outlined ); // Events this.stackLayout.connect( this, { set: 'onStackLayoutSet' } ); @@ -65,15 +64,12 @@ .addClass( 'oo-ui-bookletLayout-outlinePanel-editable' ) .append( this.outlineControlsWidget.$element ); } - this.$element.append( this.gridLayout.$element ); - } else { - this.$element.append( this.stackLayout.$element ); } }; /* Setup */ -OO.inheritClass( OO.ui.BookletLayout, OO.ui.Layout ); +OO.inheritClass( OO.ui.BookletLayout, OO.ui.MenuLayout ); /* Events */ @@ -271,6 +267,16 @@ }; /** + * Get the current page + * + * @return {OO.ui.PageLayout|undefined} Current page, if found + */ +OO.ui.BookletLayout.prototype.getCurrentPage = function () { + var name = this.getCurrentPageName(); + return name ? this.getPage( name ) : undefined; +}; + +/** * Get the current page name. * * @return {string|null} Current page name diff --git a/oojs/oojs-ui/src/widgets/ButtonWidget.js b/oojs/oojs-ui/src/widgets/ButtonWidget.js index 07768bb..d6a061d 100644 --- a/oojs/oojs-ui/src/widgets/ButtonWidget.js +++ b/oojs/oojs-ui/src/widgets/ButtonWidget.js @@ -93,10 +93,6 @@ OO.ui.ButtonWidget.prototype.onMouseDown = function ( e ) { // Remove the tab-index while the button is down to prevent the button from stealing focus this.$button.removeAttr( 'tabindex' ); - // Run the mouseup handler no matter where the mouse is when the button is let go, so we can - // reliably reapply the tabindex and remove the pressed class - this.getElementDocument().addEventListener( 'mouseup', this.onMouseUpHandler, true ); - return OO.ui.ButtonElement.prototype.onMouseDown.call( this, e ); }; @@ -106,9 +102,6 @@ OO.ui.ButtonWidget.prototype.onMouseUp = function ( e ) { // Restore the tab-index after the button is up to restore the button's accessibility this.$button.attr( 'tabindex', this.tabIndex ); - // Stop listening for mouseup, since we only needed this once - this.getElementDocument().removeEventListener( 'mouseup', this.onMouseUpHandler, true ); - return OO.ui.ButtonElement.prototype.onMouseUp.call( this, e ); }; -- To view, visit https://gerrit.wikimedia.org/r/188022 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1278a9d0f3b63977f293a79c73283593c65bf910 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/vendor Gerrit-Branch: master Gerrit-Owner: Jforrester <[email protected]> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
