jenkins-bot has submitted this change and it was merged. Change subject: [BREAKING CHANGE] Rename *Menu and *MenuItem widgets ......................................................................
[BREAKING CHANGE] Rename *Menu and *MenuItem widgets Rename *Menu and *MenuItem widgets to *MenuSelect and *MenuOption. This makes the inheritance chain clearer and avoids re-using "item", which is already used in the context of group/item. It's especially confusing that OptionWidget is a special kind of ItemWidget and MenuItemWidget is a special kind of OptionWidget, but the meaning of "Item" in MenuItemWidget is not the same as ItemWidget. This commit was generated by running this script: https://gist.github.com/trevorparscal/157656e75cd77cc93170 File name changes: Scripts (src/widgets) - TextInputMenuWidget.js → TextInputMenuSelectWidget.js - MenuWidget.js → MenuSelectWidget.js - MenuItemWidget.js → MenuOptionWidget.js - MenuSectionItemWidget.js → MenuSectionOptionWidget.js - OutlineWidget.js → OutlineSelectWidget.js - OutlineItemWidget.js → OutlineOptionWidget.js Styles (src/styles/widgets) - TextInputMenuWidget.less → TextInputMenuSelectWidget.less - MenuWidget.less → MenuSelectWidget.less - MenuItemWidget.less → MenuOptionWidget.less - MenuSectionItemWidget.less → MenuSectionOptionWidget.less - OutlineWidget.less → OutlineSelectWidget.less - OutlineItemWidget.less → OutlineOptionWidget.less File content changes: Scripts (*.js) - TextInputMenuWidget → TextInputMenuSelectWidget - MenuWidget → MenuSelectWidget - MenuItemWidget → MenuOptionWidget - MenuSectionItemWidget → MenuSectionOptionWidget - OutlineWidget → OutlineSelectWidget - OutlineItemWidget → OutlineOptionWidget Styles (*.less) - textInputMenuWidget → textInputMenuSelectWidget - menuWidget → menuSelectWidget - menuItemWidget → menuOptionWidget - menuSectionItemWidget → menuSectionOptionWidget - outlineWidget → outlineSelectWidget - outlineItemWidget → outlineOptionWidget Change-Id: I98b15437bf849bb0363229098b55d4d827ae1548 --- M build/modules.json M demos/demo.js M demos/pages/widgets.js M src/layouts/BookletLayout.js M src/layouts/PageLayout.js M src/styles/core.less M src/styles/layouts/BookletLayout.less M src/styles/theme.less M src/styles/widgets/DropdownWidget.less M src/styles/widgets/IconWidget.less R src/styles/widgets/MenuOptionWidget.less D src/styles/widgets/MenuSectionItemWidget.less A src/styles/widgets/MenuSectionOptionWidget.less R src/styles/widgets/MenuSelectWidget.less D src/styles/widgets/OutlineItemWidget.less A src/styles/widgets/OutlineOptionWidget.less A src/styles/widgets/OutlineSelectWidget.less D src/styles/widgets/OutlineWidget.less A src/styles/widgets/TextInputMenuSelectWidget.less D src/styles/widgets/TextInputMenuWidget.less M src/themes/apex/widgets.less M src/themes/blank/widgets.less M src/themes/mediawiki/widgets.less M src/widgets/ComboBoxWidget.js M src/widgets/DropdownWidget.js M src/widgets/LookupInputWidget.js D src/widgets/MenuItemWidget.js A src/widgets/MenuOptionWidget.js D src/widgets/MenuSectionItemWidget.js A src/widgets/MenuSectionOptionWidget.js R src/widgets/MenuSelectWidget.js M src/widgets/OutlineControlsWidget.js R src/widgets/OutlineOptionWidget.js A src/widgets/OutlineSelectWidget.js D src/widgets/OutlineWidget.js R src/widgets/TextInputMenuSelectWidget.js 36 files changed, 258 insertions(+), 258 deletions(-) Approvals: Catrope: Looks good to me, approved Jforrester: Looks good to me, approved jenkins-bot: Verified diff --git a/build/modules.json b/build/modules.json index 6422127..e17d25f 100644 --- a/build/modules.json +++ b/build/modules.json @@ -75,17 +75,17 @@ "src/widgets/OptionWidget.js", "src/widgets/DecoratedOptionWidget.js", "src/widgets/ButtonOptionWidget.js", - "src/widgets/MenuItemWidget.js", - "src/widgets/MenuSectionItemWidget.js", - "src/widgets/OutlineItemWidget.js", + "src/widgets/MenuOptionWidget.js", + "src/widgets/MenuSectionOptionWidget.js", + "src/widgets/OutlineOptionWidget.js", "src/widgets/PopupWidget.js", "src/widgets/ProgressBarWidget.js", "src/widgets/SearchWidget.js", "src/widgets/SelectWidget.js", "src/widgets/ButtonSelectWidget.js", - "src/widgets/MenuWidget.js", - "src/widgets/TextInputMenuWidget.js", - "src/widgets/OutlineWidget.js", + "src/widgets/MenuSelectWidget.js", + "src/widgets/TextInputMenuSelectWidget.js", + "src/widgets/OutlineSelectWidget.js", "src/widgets/ToggleSwitchWidget.js", "src/outro.js.txt" diff --git a/demos/demo.js b/demos/demo.js index 7d11103..ce36e15 100644 --- a/demos/demo.js +++ b/demos/demo.js @@ -19,10 +19,10 @@ $: this.$, menu: { items: [ - new OO.ui.MenuItemWidget( 'dialogs', { $: this.$, label: 'Dialogs' } ), - new OO.ui.MenuItemWidget( 'icons', { $: this.$, label: 'Icons' } ), - new OO.ui.MenuItemWidget( 'toolbars', { $: this.$, label: 'Toolbars' } ), - new OO.ui.MenuItemWidget( 'widgets', { $: this.$, label: 'Widgets' } ) + new OO.ui.MenuOptionWidget( 'dialogs', { $: this.$, label: 'Dialogs' } ), + new OO.ui.MenuOptionWidget( 'icons', { $: this.$, label: 'Icons' } ), + new OO.ui.MenuOptionWidget( 'toolbars', { $: this.$, label: 'Toolbars' } ), + new OO.ui.MenuOptionWidget( 'widgets', { $: this.$, label: 'Widgets' } ) ] }, classes: [ 'oo-ui-demo-pageDropdown' ] diff --git a/demos/pages/widgets.js b/demos/pages/widgets.js index 4832d2a..63268d4 100644 --- a/demos/pages/widgets.js +++ b/demos/pages/widgets.js @@ -464,19 +464,19 @@ align: 'top', menu: { items: [ - new OO.ui.MenuItemWidget( 'a', { + new OO.ui.MenuOptionWidget( 'a', { label: 'First' } ), - new OO.ui.MenuItemWidget( 'b', { + new OO.ui.MenuOptionWidget( 'b', { label: 'Second' } ), - new OO.ui.MenuItemWidget( 'c', { + new OO.ui.MenuOptionWidget( 'c', { label: 'Third' } ), - new OO.ui.MenuItemWidget( 'c', { + new OO.ui.MenuOptionWidget( 'c', { label: 'The fourth option has a long label' } ), - new OO.ui.MenuItemWidget( 'd', { + new OO.ui.MenuOptionWidget( 'd', { label: 'Fifth' } ) ] @@ -492,21 +492,21 @@ label: 'Select one', menu: { items: [ - new OO.ui.MenuItemWidget( 'a', { + new OO.ui.MenuOptionWidget( 'a', { label: 'First' } ), - new OO.ui.MenuItemWidget( 'b', { + new OO.ui.MenuOptionWidget( 'b', { label: 'Disabled second option', disabled: true } ), - new OO.ui.MenuItemWidget( 'c', { + new OO.ui.MenuOptionWidget( 'c', { label: 'Third' } ), - new OO.ui.MenuItemWidget( 'd', { + new OO.ui.MenuOptionWidget( 'd', { label: 'Disabled fourth option with long label', disabled: true } ), - new OO.ui.MenuItemWidget( 'c', { + new OO.ui.MenuOptionWidget( 'c', { label: 'Third' } ) ] @@ -523,16 +523,16 @@ disabled: true, menu: { items: [ - new OO.ui.MenuItemWidget( 'a', { + new OO.ui.MenuOptionWidget( 'a', { label: 'First' } ), - new OO.ui.MenuItemWidget( 'b', { + new OO.ui.MenuOptionWidget( 'b', { label: 'Second' } ), - new OO.ui.MenuItemWidget( 'c', { + new OO.ui.MenuOptionWidget( 'c', { label: 'Third' } ), - new OO.ui.MenuItemWidget( 'd', { + new OO.ui.MenuOptionWidget( 'd', { label: 'Fourth' } ) ] @@ -547,11 +547,11 @@ new OO.ui.ComboBoxWidget( { menu: { items: [ - new OO.ui.MenuItemWidget( 'asd', { label: 'Label for asd' } ), - new OO.ui.MenuItemWidget( 'fgh', { label: 'Label for fgh' } ), - new OO.ui.MenuItemWidget( 'jkl', { label: 'Label for jkl' } ), - new OO.ui.MenuItemWidget( 'zxc', { label: 'Label for zxc' } ), - new OO.ui.MenuItemWidget( 'vbn', { label: 'Label for vbn' } ) + new OO.ui.MenuOptionWidget( 'asd', { label: 'Label for asd' } ), + new OO.ui.MenuOptionWidget( 'fgh', { label: 'Label for fgh' } ), + new OO.ui.MenuOptionWidget( 'jkl', { label: 'Label for jkl' } ), + new OO.ui.MenuOptionWidget( 'zxc', { label: 'Label for zxc' } ), + new OO.ui.MenuOptionWidget( 'vbn', { label: 'Label for vbn' } ) ] } } ), @@ -565,11 +565,11 @@ disabled: true, menu: { items: [ - new OO.ui.MenuItemWidget( 'asd', { label: 'Label for asd' } ), - new OO.ui.MenuItemWidget( 'fgh', { label: 'Label for fgh' } ), - new OO.ui.MenuItemWidget( 'jkl', { label: 'Label for jkl' } ), - new OO.ui.MenuItemWidget( 'zxc', { label: 'Label for zxc' } ), - new OO.ui.MenuItemWidget( 'vbn', { label: 'Label for vbn' } ) + new OO.ui.MenuOptionWidget( 'asd', { label: 'Label for asd' } ), + new OO.ui.MenuOptionWidget( 'fgh', { label: 'Label for fgh' } ), + new OO.ui.MenuOptionWidget( 'jkl', { label: 'Label for jkl' } ), + new OO.ui.MenuOptionWidget( 'zxc', { label: 'Label for zxc' } ), + new OO.ui.MenuOptionWidget( 'vbn', { label: 'Label for vbn' } ) ] } } ), diff --git a/src/layouts/BookletLayout.js b/src/layouts/BookletLayout.js index ce67154..16a7af1 100644 --- a/src/layouts/BookletLayout.js +++ b/src/layouts/BookletLayout.js @@ -29,7 +29,7 @@ if ( this.outlined ) { this.editable = !!config.editable; this.outlineControlsWidget = null; - this.outlineWidget = new OO.ui.OutlineWidget( { $: this.$ } ); + 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 ], @@ -38,7 +38,7 @@ this.outlineVisible = true; if ( this.editable ) { this.outlineControlsWidget = new OO.ui.OutlineControlsWidget( - this.outlineWidget, { $: this.$ } + this.outlineSelectWidget, { $: this.$ } ); } } @@ -46,7 +46,7 @@ // Events this.stackLayout.connect( this, { set: 'onStackLayoutSet' } ); if ( this.outlined ) { - this.outlineWidget.connect( this, { select: 'onOutlineWidgetSelect' } ); + this.outlineSelectWidget.connect( this, { select: 'onOutlineSelectWidgetSelect' } ); } if ( this.autoFocus ) { // Event 'focus' does not bubble, but 'focusin' does @@ -59,7 +59,7 @@ if ( this.outlined ) { this.outlinePanel.$element .addClass( 'oo-ui-bookletLayout-outlinePanel' ) - .append( this.outlineWidget.$element ); + .append( this.outlineSelectWidget.$element ); if ( this.editable ) { this.outlinePanel.$element .addClass( 'oo-ui-bookletLayout-outlinePanel-editable' ) @@ -141,7 +141,7 @@ * * @param {OO.ui.OptionWidget|null} item Selected item */ -OO.ui.BookletLayout.prototype.onOutlineWidgetSelect = function ( item ) { +OO.ui.BookletLayout.prototype.onOutlineSelectWidgetSelect = function ( item ) { if ( item ) { this.setPage( item.getData() ); } @@ -206,16 +206,16 @@ prev = pages[index - 1]; // Prefer adjacent pages at the same level if ( this.outlined ) { - level = this.outlineWidget.getItemFromData( page.getName() ).getLevel(); + level = this.outlineSelectWidget.getItemFromData( page.getName() ).getLevel(); if ( prev && - level === this.outlineWidget.getItemFromData( prev.getName() ).getLevel() + level === this.outlineSelectWidget.getItemFromData( prev.getName() ).getLevel() ) { return prev; } if ( next && - level === this.outlineWidget.getItemFromData( next.getName() ).getLevel() + level === this.outlineSelectWidget.getItemFromData( next.getName() ).getLevel() ) { return next; } @@ -227,10 +227,10 @@ /** * Get the outline widget. * - * @return {OO.ui.OutlineWidget|null} Outline widget, or null if boolet has no outline + * @return {OO.ui.OutlineSelectWidget|null} Outline widget, or null if boolet has no outline */ OO.ui.BookletLayout.prototype.getOutline = function () { - return this.outlineWidget; + return this.outlineSelectWidget; }; /** @@ -302,15 +302,15 @@ name = page.getName(); this.pages[page.getName()] = page; if ( this.outlined ) { - item = new OO.ui.OutlineItemWidget( name, page, { $: this.$ } ); + item = new OO.ui.OutlineOptionWidget( name, page, { $: this.$ } ); page.setOutlineItem( item ); items.push( item ); } } if ( this.outlined && items.length ) { - this.outlineWidget.addItems( items, index ); - this.updateOutlineWidget(); + this.outlineSelectWidget.addItems( items, index ); + this.updateOutlineSelectWidget(); } this.stackLayout.addItems( pages, index ); this.emit( 'add', pages, index ); @@ -333,13 +333,13 @@ name = page.getName(); delete this.pages[name]; if ( this.outlined ) { - items.push( this.outlineWidget.getItemFromData( name ) ); + items.push( this.outlineSelectWidget.getItemFromData( name ) ); page.setOutlineItem( null ); } } if ( this.outlined && items.length ) { - this.outlineWidget.removeItems( items ); - this.updateOutlineWidget(); + this.outlineSelectWidget.removeItems( items ); + this.updateOutlineSelectWidget(); } this.stackLayout.removeItems( pages ); this.emit( 'remove', pages ); @@ -360,7 +360,7 @@ this.pages = {}; this.currentPageName = null; if ( this.outlined ) { - this.outlineWidget.clearItems(); + this.outlineSelectWidget.clearItems(); for ( i = 0, len = pages.length; i < len; i++ ) { pages[i].setOutlineItem( null ); } @@ -385,9 +385,9 @@ if ( name !== this.currentPageName ) { if ( this.outlined ) { - selectedItem = this.outlineWidget.getSelectedItem(); + selectedItem = this.outlineSelectWidget.getSelectedItem(); if ( selectedItem && selectedItem.getData() !== name ) { - this.outlineWidget.selectItem( this.outlineWidget.getItemFromData( name ) ); + this.outlineSelectWidget.selectItem( this.outlineSelectWidget.getItemFromData( name ) ); } } if ( page ) { @@ -412,14 +412,14 @@ }; /** - * Call this after adding or removing items from the OutlineWidget. + * Call this after adding or removing items from the OutlineSelectWidget. * * @chainable */ -OO.ui.BookletLayout.prototype.updateOutlineWidget = function () { +OO.ui.BookletLayout.prototype.updateOutlineSelectWidget = function () { // Auto-select first item when nothing is selected anymore - if ( !this.outlineWidget.getSelectedItem() ) { - this.outlineWidget.selectItem( this.outlineWidget.getFirstSelectableItem() ); + if ( !this.outlineSelectWidget.getSelectedItem() ) { + this.outlineSelectWidget.selectItem( this.outlineSelectWidget.getFirstSelectableItem() ); } return this; diff --git a/src/layouts/PageLayout.js b/src/layouts/PageLayout.js index 007da6b..dba6c47 100644 --- a/src/layouts/PageLayout.js +++ b/src/layouts/PageLayout.js @@ -59,7 +59,7 @@ /** * Get outline item. * - * @return {OO.ui.OutlineItemWidget|null} Outline item widget + * @return {OO.ui.OutlineOptionWidget|null} Outline item widget */ OO.ui.PageLayout.prototype.getOutlineItem = function () { return this.outlineItem; @@ -71,9 +71,9 @@ * @localdoc Subclasses should override #setupOutlineItem instead of this method to adjust the * outline item as desired; this method is called for setting (with an object) and unsetting * (with null) and overriding methods would have to check the value of `outlineItem` to avoid - * operating on null instead of an OO.ui.OutlineItemWidget object. + * operating on null instead of an OO.ui.OutlineOptionWidget object. * - * @param {OO.ui.OutlineItemWidget|null} outlineItem Outline item widget, null to clear + * @param {OO.ui.OutlineOptionWidget|null} outlineItem Outline item widget, null to clear * @chainable */ OO.ui.PageLayout.prototype.setOutlineItem = function ( outlineItem ) { @@ -89,7 +89,7 @@ * * @localdoc Subclasses should override this method to adjust the outline item as desired. * - * @param {OO.ui.OutlineItemWidget} outlineItem Outline item widget to setup + * @param {OO.ui.OutlineOptionWidget} outlineItem Outline item widget to setup * @chainable */ OO.ui.PageLayout.prototype.setupOutlineItem = function () { diff --git a/src/styles/core.less b/src/styles/core.less index 139384c..8b7c135 100644 --- a/src/styles/core.less +++ b/src/styles/core.less @@ -77,14 +77,14 @@ @import 'widgets/CheckboxInputWidget.less'; @import 'widgets/TextInputWidget.less'; -@import 'widgets/MenuWidget.less'; -@import 'widgets/MenuItemWidget.less'; -@import 'widgets/MenuSectionItemWidget.less'; -@import 'widgets/TextInputMenuWidget.less'; +@import 'widgets/MenuSelectWidget.less'; +@import 'widgets/MenuOptionWidget.less'; +@import 'widgets/MenuSectionOptionWidget.less'; +@import 'widgets/TextInputMenuSelectWidget.less'; @import 'widgets/DropdownWidget.less'; -@import 'widgets/OutlineWidget.less'; -@import 'widgets/OutlineItemWidget.less'; +@import 'widgets/OutlineSelectWidget.less'; +@import 'widgets/OutlineOptionWidget.less'; @import 'widgets/OutlineControlsWidget.less'; @import 'widgets/ComboBoxWidget.less'; diff --git a/src/styles/layouts/BookletLayout.less b/src/styles/layouts/BookletLayout.less index d5ab767..e311e6f 100644 --- a/src/styles/layouts/BookletLayout.less +++ b/src/styles/layouts/BookletLayout.less @@ -22,7 +22,7 @@ } &-outlinePanel { - &-editable .oo-ui-outlineWidget { + &-editable .oo-ui-outlineSelectWidget { position: absolute; top: 0; left: 0; diff --git a/src/styles/theme.less b/src/styles/theme.less index 4b9db5f..0af652f 100644 --- a/src/styles/theme.less +++ b/src/styles/theme.less @@ -63,14 +63,14 @@ .theme-oo-ui-optionWidget () {} .theme-oo-ui-decoratedOptionWidget () {} .theme-oo-ui-buttonOptionWidget () {} -.theme-oo-ui-menuItemWidget () {} -.theme-oo-ui-menuSectionItemWidget () {} -.theme-oo-ui-outlineItemWidget () {} +.theme-oo-ui-menuOptionWidget () {} +.theme-oo-ui-menuSectionOptionWidget () {} +.theme-oo-ui-outlineOptionWidget () {} .theme-oo-ui-popupWidget () {} .theme-oo-ui-searchWidget () {} .theme-oo-ui-selectWidget () {} .theme-oo-ui-buttonSelectWidget () {} -.theme-oo-ui-menuWidget () {} -.theme-oo-ui-textInputMenuWidget () {} -.theme-oo-ui-outlineWidget () {} +.theme-oo-ui-menuSelectWidget () {} +.theme-oo-ui-textInputMenuSelectWidget () {} +.theme-oo-ui-outlineSelectWidget () {} .theme-oo-ui-toggleSwitchWidget () {} diff --git a/src/styles/widgets/DropdownWidget.less b/src/styles/widgets/DropdownWidget.less index 39491dc..8a7c4b6 100644 --- a/src/styles/widgets/DropdownWidget.less +++ b/src/styles/widgets/DropdownWidget.less @@ -21,7 +21,7 @@ } } - .oo-ui-menuWidget { + .oo-ui-menuSelectWidget { z-index: 1; width: 100%; } diff --git a/src/styles/widgets/IconWidget.less b/src/styles/widgets/IconWidget.less index 45176f5..03f6ab7 100644 --- a/src/styles/widgets/IconWidget.less +++ b/src/styles/widgets/IconWidget.less @@ -7,4 +7,4 @@ background-repeat: no-repeat; .theme-oo-ui-iconWidget(); -} \ No newline at end of file +} diff --git a/src/styles/widgets/MenuItemWidget.less b/src/styles/widgets/MenuOptionWidget.less similarity index 79% rename from src/styles/widgets/MenuItemWidget.less rename to src/styles/widgets/MenuOptionWidget.less index b0d60e3..f7f9f7a 100644 --- a/src/styles/widgets/MenuItemWidget.less +++ b/src/styles/widgets/MenuOptionWidget.less @@ -1,6 +1,6 @@ @import '../common'; -.oo-ui-menuItemWidget { +.oo-ui-menuOptionWidget { position: relative; .oo-ui-iconElement-icon { @@ -17,5 +17,5 @@ } } - .theme-oo-ui-menuItemWidget(); + .theme-oo-ui-menuOptionWidget(); } diff --git a/src/styles/widgets/MenuSectionItemWidget.less b/src/styles/widgets/MenuSectionItemWidget.less deleted file mode 100644 index 595741b..0000000 --- a/src/styles/widgets/MenuSectionItemWidget.less +++ /dev/null @@ -1,8 +0,0 @@ -@import '../common'; - -.oo-ui-menuSectionItemWidget { - cursor: default; - - .theme-oo-ui-menuSectionItemWidget(); -} - diff --git a/src/styles/widgets/MenuSectionOptionWidget.less b/src/styles/widgets/MenuSectionOptionWidget.less new file mode 100644 index 0000000..f670f7f --- /dev/null +++ b/src/styles/widgets/MenuSectionOptionWidget.less @@ -0,0 +1,8 @@ +@import '../common'; + +.oo-ui-menuSectionOptionWidget { + cursor: default; + + .theme-oo-ui-menuSectionOptionWidget(); +} + diff --git a/src/styles/widgets/MenuWidget.less b/src/styles/widgets/MenuSelectWidget.less similarity index 70% rename from src/styles/widgets/MenuWidget.less rename to src/styles/widgets/MenuSelectWidget.less index 9aa036b..0585469 100644 --- a/src/styles/widgets/MenuWidget.less +++ b/src/styles/widgets/MenuSelectWidget.less @@ -1,6 +1,6 @@ @import '../common'; -.oo-ui-menuWidget { +.oo-ui-menuSelectWidget { position: absolute; input { @@ -11,5 +11,5 @@ opacity: 0; } - .theme-oo-ui-menuWidget(); + .theme-oo-ui-menuSelectWidget(); } diff --git a/src/styles/widgets/OutlineItemWidget.less b/src/styles/widgets/OutlineItemWidget.less deleted file mode 100644 index f901869..0000000 --- a/src/styles/widgets/OutlineItemWidget.less +++ /dev/null @@ -1,9 +0,0 @@ -@import '../common'; - -.oo-ui-outlineItemWidget { - position: relative; - cursor: pointer; - .oo-ui-unselectable(); - - .theme-oo-ui-outlineItemWidget(); -} diff --git a/src/styles/widgets/OutlineOptionWidget.less b/src/styles/widgets/OutlineOptionWidget.less new file mode 100644 index 0000000..6558c65 --- /dev/null +++ b/src/styles/widgets/OutlineOptionWidget.less @@ -0,0 +1,9 @@ +@import '../common'; + +.oo-ui-outlineOptionWidget { + position: relative; + cursor: pointer; + .oo-ui-unselectable(); + + .theme-oo-ui-outlineOptionWidget(); +} diff --git a/src/styles/widgets/OutlineSelectWidget.less b/src/styles/widgets/OutlineSelectWidget.less new file mode 100644 index 0000000..65fc621 --- /dev/null +++ b/src/styles/widgets/OutlineSelectWidget.less @@ -0,0 +1,5 @@ +@import '../common'; + +.oo-ui-outlineSelectWidget { + .theme-oo-ui-outlineSelectWidget(); +} diff --git a/src/styles/widgets/OutlineWidget.less b/src/styles/widgets/OutlineWidget.less deleted file mode 100644 index da731fa..0000000 --- a/src/styles/widgets/OutlineWidget.less +++ /dev/null @@ -1,5 +0,0 @@ -@import '../common'; - -.oo-ui-outlineWidget { - .theme-oo-ui-outlineWidget(); -} diff --git a/src/styles/widgets/TextInputMenuSelectWidget.less b/src/styles/widgets/TextInputMenuSelectWidget.less new file mode 100644 index 0000000..6edc474 --- /dev/null +++ b/src/styles/widgets/TextInputMenuSelectWidget.less @@ -0,0 +1,5 @@ +@import '../common'; + +.oo-ui-textInputMenuSelectWidget { + .theme-oo-ui-textInputMenuSelectWidget(); +} diff --git a/src/styles/widgets/TextInputMenuWidget.less b/src/styles/widgets/TextInputMenuWidget.less deleted file mode 100644 index 0da400f..0000000 --- a/src/styles/widgets/TextInputMenuWidget.less +++ /dev/null @@ -1,5 +0,0 @@ -@import '../common'; - -.oo-ui-textInputMenuWidget { - .theme-oo-ui-textInputMenuWidget(); -} diff --git a/src/themes/apex/widgets.less b/src/themes/apex/widgets.less index 2d5cbe1..4ee4233 100644 --- a/src/themes/apex/widgets.less +++ b/src/themes/apex/widgets.less @@ -355,7 +355,7 @@ } } -.theme-oo-ui-menuItemWidget () { +.theme-oo-ui-menuOptionWidget () { &.oo-ui-optionWidget { &-selected { background-color: transparent; @@ -367,12 +367,12 @@ } } -.theme-oo-ui-menuSectionItemWidget () { +.theme-oo-ui-menuSectionOptionWidget () { padding: 0.33em 0.75em; color: #888; } -.theme-oo-ui-outlineItemWidget () { +.theme-oo-ui-outlineOptionWidget () { font-size: 1.1em; padding: 0.75em; @@ -538,7 +538,7 @@ } } -.theme-oo-ui-menuWidget () { +.theme-oo-ui-menuSelectWidget () { background: #fff; margin-top: -1px; border: solid 1px #ccc; @@ -546,9 +546,9 @@ box-shadow: 0 0.15em 1em 0 rgba(0, 0, 0, 0.2); } -.theme-oo-ui-textInputMenuWidget () {} +.theme-oo-ui-textInputMenuSelectWidget () {} -.theme-oo-ui-outlineWidget () {} +.theme-oo-ui-outlineSelectWidget () {} .theme-oo-ui-toggleSwitchWidget () { @travelDistance: 2em; diff --git a/src/themes/blank/widgets.less b/src/themes/blank/widgets.less index 2bdced2..20f428e 100644 --- a/src/themes/blank/widgets.less +++ b/src/themes/blank/widgets.less @@ -40,11 +40,11 @@ .theme-oo-ui-buttonOptionWidget () {} -.theme-oo-ui-menuItemWidget () {} +.theme-oo-ui-menuOptionWidget () {} -.theme-oo-ui-menuSectionItemWidget () {} +.theme-oo-ui-menuSectionOptionWidget () {} -.theme-oo-ui-outlineItemWidget () {} +.theme-oo-ui-outlineOptionWidget () {} .theme-oo-ui-popupWidget () {} @@ -54,11 +54,11 @@ .theme-oo-ui-buttonSelectWidget () {} -.theme-oo-ui-menuWidget () {} +.theme-oo-ui-menuSelectWidget () {} -.theme-oo-ui-textInputMenuWidget () {} +.theme-oo-ui-textInputMenuSelectWidget () {} -.theme-oo-ui-outlineWidget () {} +.theme-oo-ui-outlineSelectWidget () {} .theme-oo-ui-toggleSwitchWidget () {} diff --git a/src/themes/mediawiki/widgets.less b/src/themes/mediawiki/widgets.less index 1ee7506..75c9aa0 100644 --- a/src/themes/mediawiki/widgets.less +++ b/src/themes/mediawiki/widgets.less @@ -403,7 +403,7 @@ } } -.theme-oo-ui-menuItemWidget () { +.theme-oo-ui-menuOptionWidget () { &.oo-ui-optionWidget { &-selected { background-color: transparent; @@ -414,12 +414,12 @@ } } -.theme-oo-ui-menuSectionItemWidget () { +.theme-oo-ui-menuSectionOptionWidget () { padding: 0.33em 0.75em; color: #888; } -.theme-oo-ui-outlineItemWidget () {} +.theme-oo-ui-outlineOptionWidget () {} .theme-oo-ui-popupWidget () { &-popup { @@ -548,7 +548,7 @@ } } -.theme-oo-ui-menuWidget () { +.theme-oo-ui-menuSelectWidget () { background: #fff; margin-top: -1px; border: solid 1px #aaa; @@ -557,9 +557,9 @@ box-shadow: inset 0 -0.2em 0 0 rgba(0,0,0,0.2), 0 0.1em 0 0 rgba(0,0,0,0.2); } -.theme-oo-ui-textInputMenuWidget () {} +.theme-oo-ui-textInputMenuSelectWidget () {} -.theme-oo-ui-outlineWidget () {} +.theme-oo-ui-outlineSelectWidget () {} .theme-oo-ui-toggleSwitchWidget () { @travelDistance: 2em; diff --git a/src/widgets/ComboBoxWidget.js b/src/widgets/ComboBoxWidget.js index d021535..863e3b2 100644 --- a/src/widgets/ComboBoxWidget.js +++ b/src/widgets/ComboBoxWidget.js @@ -23,7 +23,7 @@ { $: this.$, indicator: 'down', disabled: this.isDisabled() }, config.input ) ); - this.menu = new OO.ui.TextInputMenuWidget( this.input, $.extend( + this.menu = new OO.ui.TextInputMenuSelectWidget( this.input, $.extend( { $: OO.ui.Element.getJQuery( this.$overlay ), widget: this, diff --git a/src/widgets/DropdownWidget.js b/src/widgets/DropdownWidget.js index a3aef0c..1665a9c 100644 --- a/src/widgets/DropdownWidget.js +++ b/src/widgets/DropdownWidget.js @@ -4,7 +4,7 @@ * Dropdown menus provide a control for accessing a menu and compose a menu within the widget, which * can be accessed using the #getMenu method. * - * Use with OO.ui.MenuItemWidget. + * Use with OO.ui.MenuOptionWidget. * * @class * @extends OO.ui.Widget @@ -31,7 +31,7 @@ OO.ui.TitledElement.call( this, $.extend( {}, config, { $titled: this.$label } ) ); // Properties - this.menu = new OO.ui.MenuWidget( $.extend( { $: this.$, widget: this }, config.menu ) ); + this.menu = new OO.ui.MenuSelectWidget( $.extend( { $: this.$, widget: this }, config.menu ) ); this.$handle = this.$( '<span>' ); // Events @@ -60,7 +60,7 @@ /** * Get the menu. * - * @return {OO.ui.MenuWidget} Menu of widget + * @return {OO.ui.MenuSelectWidget} Menu of widget */ OO.ui.DropdownWidget.prototype.getMenu = function () { return this.menu; @@ -69,7 +69,7 @@ /** * Handles menu select events. * - * @param {OO.ui.MenuItemWidget} item Selected menu item + * @param {OO.ui.MenuOptionWidget} item Selected menu item */ OO.ui.DropdownWidget.prototype.onMenuSelect = function ( item ) { var selectedLabel; diff --git a/src/widgets/LookupInputWidget.js b/src/widgets/LookupInputWidget.js index 495f5cf..1ad9577 100644 --- a/src/widgets/LookupInputWidget.js +++ b/src/widgets/LookupInputWidget.js @@ -23,7 +23,7 @@ // Properties this.lookupInput = input; this.$overlay = config.$overlay || this.$element; - this.lookupMenu = new OO.ui.TextInputMenuWidget( this, { + this.lookupMenu = new OO.ui.TextInputMenuSelectWidget( this, { $: OO.ui.Element.getJQuery( this.$overlay ), input: this.lookupInput, $container: config.$container @@ -105,7 +105,7 @@ if ( !visible ) { // When the menu is hidden, abort any active request and clear the menu. // This has to be done here in addition to closeLookupMenu(), because - // MenuWidget will close itself when the user presses Esc. + // MenuSelectWidget will close itself when the user presses Esc. this.abortLookupRequest(); this.lookupMenu.clearItems(); } @@ -114,7 +114,7 @@ /** * Get lookup menu. * - * @return {OO.ui.TextInputMenuWidget} + * @return {OO.ui.TextInputMenuSelectWidget} */ OO.ui.LookupInputWidget.prototype.getLookupMenu = function () { return this.lookupMenu; @@ -291,7 +291,7 @@ * * @abstract * @param {Mixed} data Cached result data, usually an array - * @return {OO.ui.MenuItemWidget[]} Menu items + * @return {OO.ui.MenuOptionWidget[]} Menu items */ OO.ui.LookupInputWidget.prototype.getLookupMenuItemsFromData = function () { // Stub, implemented in subclass diff --git a/src/widgets/MenuItemWidget.js b/src/widgets/MenuItemWidget.js deleted file mode 100644 index 6f2e059..0000000 --- a/src/widgets/MenuItemWidget.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Item of an OO.ui.MenuWidget. - * - * @class - * @extends OO.ui.DecoratedOptionWidget - * - * @constructor - * @param {Mixed} data Item data - * @param {Object} [config] Configuration options - */ -OO.ui.MenuItemWidget = function OoUiMenuItemWidget( data, config ) { - // Configuration initialization - config = $.extend( { icon: 'check' }, config ); - - // Parent constructor - OO.ui.MenuItemWidget.super.call( this, data, config ); - - // Initialization - this.$element - .attr( 'role', 'menuitem' ) - .addClass( 'oo-ui-menuItemWidget' ); -}; - -/* Setup */ - -OO.inheritClass( OO.ui.MenuItemWidget, OO.ui.DecoratedOptionWidget ); diff --git a/src/widgets/MenuOptionWidget.js b/src/widgets/MenuOptionWidget.js new file mode 100644 index 0000000..b2a2f85 --- /dev/null +++ b/src/widgets/MenuOptionWidget.js @@ -0,0 +1,26 @@ +/** + * Item of an OO.ui.MenuSelectWidget. + * + * @class + * @extends OO.ui.DecoratedOptionWidget + * + * @constructor + * @param {Mixed} data Item data + * @param {Object} [config] Configuration options + */ +OO.ui.MenuOptionWidget = function OoUiMenuOptionWidget( data, config ) { + // Configuration initialization + config = $.extend( { icon: 'check' }, config ); + + // Parent constructor + OO.ui.MenuOptionWidget.super.call( this, data, config ); + + // Initialization + this.$element + .attr( 'role', 'menuitem' ) + .addClass( 'oo-ui-menuOptionWidget' ); +}; + +/* Setup */ + +OO.inheritClass( OO.ui.MenuOptionWidget, OO.ui.DecoratedOptionWidget ); diff --git a/src/widgets/MenuSectionItemWidget.js b/src/widgets/MenuSectionItemWidget.js deleted file mode 100644 index af00206..0000000 --- a/src/widgets/MenuSectionItemWidget.js +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Section to group one or more items in a OO.ui.MenuWidget. - * - * @class - * @extends OO.ui.DecoratedOptionWidget - * - * @constructor - * @param {Mixed} data Item data - * @param {Object} [config] Configuration options - */ -OO.ui.MenuSectionItemWidget = function OoUiMenuSectionItemWidget( data, config ) { - // Parent constructor - OO.ui.MenuSectionItemWidget.super.call( this, data, config ); - - // Initialization - this.$element.addClass( 'oo-ui-menuSectionItemWidget' ); -}; - -/* Setup */ - -OO.inheritClass( OO.ui.MenuSectionItemWidget, OO.ui.DecoratedOptionWidget ); - -/* Static Properties */ - -OO.ui.MenuSectionItemWidget.static.selectable = false; - -OO.ui.MenuSectionItemWidget.static.highlightable = false; diff --git a/src/widgets/MenuSectionOptionWidget.js b/src/widgets/MenuSectionOptionWidget.js new file mode 100644 index 0000000..f678987 --- /dev/null +++ b/src/widgets/MenuSectionOptionWidget.js @@ -0,0 +1,27 @@ +/** + * Section to group one or more items in a OO.ui.MenuSelectWidget. + * + * @class + * @extends OO.ui.DecoratedOptionWidget + * + * @constructor + * @param {Mixed} data Item data + * @param {Object} [config] Configuration options + */ +OO.ui.MenuSectionOptionWidget = function OoUiMenuSectionOptionWidget( data, config ) { + // Parent constructor + OO.ui.MenuSectionOptionWidget.super.call( this, data, config ); + + // Initialization + this.$element.addClass( 'oo-ui-menuSectionOptionWidget' ); +}; + +/* Setup */ + +OO.inheritClass( OO.ui.MenuSectionOptionWidget, OO.ui.DecoratedOptionWidget ); + +/* Static Properties */ + +OO.ui.MenuSectionOptionWidget.static.selectable = false; + +OO.ui.MenuSectionOptionWidget.static.highlightable = false; diff --git a/src/widgets/MenuWidget.js b/src/widgets/MenuSelectWidget.js similarity index 81% rename from src/widgets/MenuWidget.js rename to src/widgets/MenuSelectWidget.js index 2a0467a..186d914 100644 --- a/src/widgets/MenuWidget.js +++ b/src/widgets/MenuSelectWidget.js @@ -4,7 +4,7 @@ * Menus are clipped to the visible viewport. They do not provide a control for opening or closing * the menu. * - * Use together with OO.ui.MenuItemWidget. + * Use together with OO.ui.MenuOptionWidget. * * @class * @extends OO.ui.SelectWidget @@ -16,12 +16,12 @@ * @cfg {OO.ui.Widget} [widget] Widget to bind mouse handlers to * @cfg {boolean} [autoHide=true] Hide the menu when the mouse is pressed outside the menu */ -OO.ui.MenuWidget = function OoUiMenuWidget( config ) { +OO.ui.MenuSelectWidget = function OoUiMenuSelectWidget( config ) { // Configuration initialization config = config || {}; // Parent constructor - OO.ui.MenuWidget.super.call( this, config ); + OO.ui.MenuSelectWidget.super.call( this, config ); // Mixin constructors OO.ui.ClippableElement.call( this, $.extend( {}, config, { $clippable: this.$group } ) ); @@ -42,13 +42,13 @@ this.$element .hide() .attr( 'role', 'menu' ) - .addClass( 'oo-ui-menuWidget' ); + .addClass( 'oo-ui-menuSelectWidget' ); }; /* Setup */ -OO.inheritClass( OO.ui.MenuWidget, OO.ui.SelectWidget ); -OO.mixinClass( OO.ui.MenuWidget, OO.ui.ClippableElement ); +OO.inheritClass( OO.ui.MenuSelectWidget, OO.ui.SelectWidget ); +OO.mixinClass( OO.ui.MenuSelectWidget, OO.ui.ClippableElement ); /* Methods */ @@ -57,7 +57,7 @@ * * @param {jQuery.Event} e Key down event */ -OO.ui.MenuWidget.prototype.onDocumentMouseDown = function ( e ) { +OO.ui.MenuSelectWidget.prototype.onDocumentMouseDown = function ( e ) { if ( !OO.ui.contains( this.$element[0], e.target, true ) && ( !this.$widget || !OO.ui.contains( this.$widget[0], e.target, true ) ) @@ -71,7 +71,7 @@ * * @param {jQuery.Event} e Key down event */ -OO.ui.MenuWidget.prototype.onKeyDown = function ( e ) { +OO.ui.MenuSelectWidget.prototype.onKeyDown = function ( e ) { var nextItem, handled = false, highlightItem = this.getHighlightedItem(); @@ -118,7 +118,7 @@ /** * Bind key down listener. */ -OO.ui.MenuWidget.prototype.bindKeyDownListener = function () { +OO.ui.MenuSelectWidget.prototype.bindKeyDownListener = function () { if ( this.$input ) { this.$input.on( 'keydown', this.onKeyDownHandler ); } else { @@ -130,7 +130,7 @@ /** * Unbind key down listener. */ -OO.ui.MenuWidget.prototype.unbindKeyDownListener = function () { +OO.ui.MenuSelectWidget.prototype.unbindKeyDownListener = function () { if ( this.$input ) { this.$input.off( 'keydown' ); } else { @@ -146,11 +146,11 @@ * @param {OO.ui.OptionWidget} item Item to choose * @chainable */ -OO.ui.MenuWidget.prototype.chooseItem = function ( item ) { +OO.ui.MenuSelectWidget.prototype.chooseItem = function ( item ) { var widget = this; // Parent method - OO.ui.MenuWidget.super.prototype.chooseItem.call( this, item ); + OO.ui.MenuSelectWidget.super.prototype.chooseItem.call( this, item ); if ( item && !this.flashing ) { this.flashing = true; @@ -168,11 +168,11 @@ /** * @inheritdoc */ -OO.ui.MenuWidget.prototype.addItems = function ( items, index ) { +OO.ui.MenuSelectWidget.prototype.addItems = function ( items, index ) { var i, len, item; // Parent method - OO.ui.MenuWidget.super.prototype.addItems.call( this, items, index ); + OO.ui.MenuSelectWidget.super.prototype.addItems.call( this, items, index ); // Auto-initialize if ( !this.newItems ) { @@ -198,9 +198,9 @@ /** * @inheritdoc */ -OO.ui.MenuWidget.prototype.removeItems = function ( items ) { +OO.ui.MenuSelectWidget.prototype.removeItems = function ( items ) { // Parent method - OO.ui.MenuWidget.super.prototype.removeItems.call( this, items ); + OO.ui.MenuSelectWidget.super.prototype.removeItems.call( this, items ); // Reevaluate clipping this.clip(); @@ -211,9 +211,9 @@ /** * @inheritdoc */ -OO.ui.MenuWidget.prototype.clearItems = function () { +OO.ui.MenuSelectWidget.prototype.clearItems = function () { // Parent method - OO.ui.MenuWidget.super.prototype.clearItems.call( this ); + OO.ui.MenuSelectWidget.super.prototype.clearItems.call( this ); // Reevaluate clipping this.clip(); @@ -224,7 +224,7 @@ /** * @inheritdoc */ -OO.ui.MenuWidget.prototype.toggle = function ( visible ) { +OO.ui.MenuSelectWidget.prototype.toggle = function ( visible ) { visible = ( visible === undefined ? !this.visible : !!visible ) && !!this.items.length; var i, len, @@ -233,7 +233,7 @@ widgetDoc = this.$widget ? this.$widget[0].ownerDocument : null; // Parent method - OO.ui.MenuWidget.super.prototype.toggle.call( this, visible ); + OO.ui.MenuSelectWidget.super.prototype.toggle.call( this, visible ); if ( change ) { if ( visible ) { diff --git a/src/widgets/OutlineControlsWidget.js b/src/widgets/OutlineControlsWidget.js index 4cbfffc..d5786ef 100644 --- a/src/widgets/OutlineControlsWidget.js +++ b/src/widgets/OutlineControlsWidget.js @@ -1,5 +1,5 @@ /** - * Set of controls for an OO.ui.OutlineWidget. + * Set of controls for an OO.ui.OutlineSelectWidget. * * Controls include moving items up and down, removing items, and adding different kinds of items. * @@ -9,7 +9,7 @@ * @mixins OO.ui.IconElement * * @constructor - * @param {OO.ui.OutlineWidget} outline Outline to control + * @param {OO.ui.OutlineSelectWidget} outline Outline to control * @param {Object} [config] Configuration options */ OO.ui.OutlineControlsWidget = function OoUiOutlineControlsWidget( outline, config ) { diff --git a/src/widgets/OutlineItemWidget.js b/src/widgets/OutlineOptionWidget.js similarity index 66% rename from src/widgets/OutlineItemWidget.js rename to src/widgets/OutlineOptionWidget.js index 543d4c5..aa60ef8 100644 --- a/src/widgets/OutlineItemWidget.js +++ b/src/widgets/OutlineOptionWidget.js @@ -1,5 +1,5 @@ /** - * Items for an OO.ui.OutlineWidget. + * Items for an OO.ui.OutlineSelectWidget. * * @class * @extends OO.ui.DecoratedOptionWidget @@ -10,12 +10,12 @@ * @cfg {number} [level] Indentation level * @cfg {boolean} [movable] Allow modification from outline controls */ -OO.ui.OutlineItemWidget = function OoUiOutlineItemWidget( data, config ) { +OO.ui.OutlineOptionWidget = function OoUiOutlineOptionWidget( data, config ) { // Configuration initialization config = config || {}; // Parent constructor - OO.ui.OutlineItemWidget.super.call( this, data, config ); + OO.ui.OutlineOptionWidget.super.call( this, data, config ); // Properties this.level = 0; @@ -23,23 +23,23 @@ this.removable = !!config.removable; // Initialization - this.$element.addClass( 'oo-ui-outlineItemWidget' ); + this.$element.addClass( 'oo-ui-outlineOptionWidget' ); this.setLevel( config.level ); }; /* Setup */ -OO.inheritClass( OO.ui.OutlineItemWidget, OO.ui.DecoratedOptionWidget ); +OO.inheritClass( OO.ui.OutlineOptionWidget, OO.ui.DecoratedOptionWidget ); /* Static Properties */ -OO.ui.OutlineItemWidget.static.highlightable = false; +OO.ui.OutlineOptionWidget.static.highlightable = false; -OO.ui.OutlineItemWidget.static.scrollIntoViewOnSelect = true; +OO.ui.OutlineOptionWidget.static.scrollIntoViewOnSelect = true; -OO.ui.OutlineItemWidget.static.levelClass = 'oo-ui-outlineItemWidget-level-'; +OO.ui.OutlineOptionWidget.static.levelClass = 'oo-ui-outlineOptionWidget-level-'; -OO.ui.OutlineItemWidget.static.levels = 3; +OO.ui.OutlineOptionWidget.static.levels = 3; /* Methods */ @@ -50,7 +50,7 @@ * * @return {boolean} Item is movable */ -OO.ui.OutlineItemWidget.prototype.isMovable = function () { +OO.ui.OutlineOptionWidget.prototype.isMovable = function () { return this.movable; }; @@ -61,7 +61,7 @@ * * @return {boolean} Item is removable */ -OO.ui.OutlineItemWidget.prototype.isRemovable = function () { +OO.ui.OutlineOptionWidget.prototype.isRemovable = function () { return this.removable; }; @@ -70,7 +70,7 @@ * * @return {number} Indentation level */ -OO.ui.OutlineItemWidget.prototype.getLevel = function () { +OO.ui.OutlineOptionWidget.prototype.getLevel = function () { return this.level; }; @@ -82,7 +82,7 @@ * @param {boolean} movable Item is movable * @chainable */ -OO.ui.OutlineItemWidget.prototype.setMovable = function ( movable ) { +OO.ui.OutlineOptionWidget.prototype.setMovable = function ( movable ) { this.movable = !!movable; this.updateThemeClasses(); return this; @@ -96,7 +96,7 @@ * @param {boolean} movable Item is removable * @chainable */ -OO.ui.OutlineItemWidget.prototype.setRemovable = function ( removable ) { +OO.ui.OutlineOptionWidget.prototype.setRemovable = function ( removable ) { this.removable = !!removable; this.updateThemeClasses(); return this; @@ -108,7 +108,7 @@ * @param {number} [level=0] Indentation level, in the range of [0,#maxLevel] * @chainable */ -OO.ui.OutlineItemWidget.prototype.setLevel = function ( level ) { +OO.ui.OutlineOptionWidget.prototype.setLevel = function ( level ) { var levels = this.constructor.static.levels, levelClass = this.constructor.static.levelClass, i = levels; diff --git a/src/widgets/OutlineSelectWidget.js b/src/widgets/OutlineSelectWidget.js new file mode 100644 index 0000000..2395d5c --- /dev/null +++ b/src/widgets/OutlineSelectWidget.js @@ -0,0 +1,25 @@ +/** + * Structured list of items. + * + * Use with OO.ui.OutlineOptionWidget. + * + * @class + * @extends OO.ui.SelectWidget + * + * @constructor + * @param {Object} [config] Configuration options + */ +OO.ui.OutlineSelectWidget = function OoUiOutlineSelectWidget( config ) { + // Configuration initialization + config = config || {}; + + // Parent constructor + OO.ui.OutlineSelectWidget.super.call( this, config ); + + // Initialization + this.$element.addClass( 'oo-ui-outlineSelectWidget' ); +}; + +/* Setup */ + +OO.inheritClass( OO.ui.OutlineSelectWidget, OO.ui.SelectWidget ); diff --git a/src/widgets/OutlineWidget.js b/src/widgets/OutlineWidget.js deleted file mode 100644 index a674921..0000000 --- a/src/widgets/OutlineWidget.js +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Structured list of items. - * - * Use with OO.ui.OutlineItemWidget. - * - * @class - * @extends OO.ui.SelectWidget - * - * @constructor - * @param {Object} [config] Configuration options - */ -OO.ui.OutlineWidget = function OoUiOutlineWidget( config ) { - // Configuration initialization - config = config || {}; - - // Parent constructor - OO.ui.OutlineWidget.super.call( this, config ); - - // Initialization - this.$element.addClass( 'oo-ui-outlineWidget' ); -}; - -/* Setup */ - -OO.inheritClass( OO.ui.OutlineWidget, OO.ui.SelectWidget ); diff --git a/src/widgets/TextInputMenuWidget.js b/src/widgets/TextInputMenuSelectWidget.js similarity index 76% rename from src/widgets/TextInputMenuWidget.js rename to src/widgets/TextInputMenuSelectWidget.js index 0ead9bf..823e9d8 100644 --- a/src/widgets/TextInputMenuWidget.js +++ b/src/widgets/TextInputMenuSelectWidget.js @@ -6,19 +6,19 @@ * menu is toggled or the window is resized. * * @class - * @extends OO.ui.MenuWidget + * @extends OO.ui.MenuSelectWidget * * @constructor * @param {OO.ui.TextInputWidget} input Text input widget to provide menu for * @param {Object} [config] Configuration options * @cfg {jQuery} [$container=input.$element] Element to render menu under */ -OO.ui.TextInputMenuWidget = function OoUiTextInputMenuWidget( input, config ) { +OO.ui.TextInputMenuSelectWidget = function OoUiTextInputMenuSelectWidget( input, config ) { // Configuration intialization config = config || {}; // Parent constructor - OO.ui.TextInputMenuWidget.super.call( this, config ); + OO.ui.TextInputMenuSelectWidget.super.call( this, config ); // Properties this.input = input; @@ -26,12 +26,12 @@ this.onWindowResizeHandler = this.onWindowResize.bind( this ); // Initialization - this.$element.addClass( 'oo-ui-textInputMenuWidget' ); + this.$element.addClass( 'oo-ui-textInputMenuSelectWidget' ); }; /* Setup */ -OO.inheritClass( OO.ui.TextInputMenuWidget, OO.ui.MenuWidget ); +OO.inheritClass( OO.ui.TextInputMenuSelectWidget, OO.ui.MenuSelectWidget ); /* Methods */ @@ -40,14 +40,14 @@ * * @param {jQuery.Event} e Window resize event */ -OO.ui.TextInputMenuWidget.prototype.onWindowResize = function () { +OO.ui.TextInputMenuSelectWidget.prototype.onWindowResize = function () { this.position(); }; /** * @inheritdoc */ -OO.ui.TextInputMenuWidget.prototype.toggle = function ( visible ) { +OO.ui.TextInputMenuSelectWidget.prototype.toggle = function ( visible ) { visible = visible === undefined ? !this.isVisible() : !!visible; var change = visible !== this.isVisible(); @@ -60,7 +60,7 @@ } // Parent method - OO.ui.TextInputMenuWidget.super.prototype.toggle.call( this, visible ); + OO.ui.TextInputMenuSelectWidget.super.prototype.toggle.call( this, visible ); if ( change ) { if ( this.isVisible() ) { @@ -79,7 +79,7 @@ * * @chainable */ -OO.ui.TextInputMenuWidget.prototype.position = function () { +OO.ui.TextInputMenuSelectWidget.prototype.position = function () { var $container = this.$container, pos = OO.ui.Element.getRelativePosition( $container, this.$element.offsetParent() ); -- To view, visit https://gerrit.wikimedia.org/r/173356 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I98b15437bf849bb0363229098b55d4d827ae1548 Gerrit-PatchSet: 4 Gerrit-Project: oojs/ui Gerrit-Branch: master Gerrit-Owner: Trevor Parscal <[email protected]> Gerrit-Reviewer: Bartosz Dziewoński <[email protected]> Gerrit-Reviewer: Catrope <[email protected]> Gerrit-Reviewer: Jforrester <[email protected]> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
