From: James D. Forrester Date: Mon, 22 Feb 2016 22:36:25 +0000 (-0800) Subject: Update OOjs UI to v0.16.0 X-Git-Tag: 1.31.0-rc.0~7871^2 X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/bilan.php?a=commitdiff_plain;h=1cdee33835539c706477add44c531ec6683d870b;p=lhc%2Fweb%2Fwiklou.git Update OOjs UI to v0.16.0 Release notes: https://git.wikimedia.org/blob/oojs%2Fui.git/v0.16.0/History.md Change-Id: I9c170fce1c65ae65b0b33342572fe4d3bb613774 --- diff --git a/composer.json b/composer.json index f1149149b0..c5b4395a4a 100644 --- a/composer.json +++ b/composer.json @@ -21,7 +21,7 @@ "ext-iconv": "*", "liuggio/statsd-php-client": "1.0.18", "mediawiki/at-ease": "1.1.0", - "oojs/oojs-ui": "0.15.4", + "oojs/oojs-ui": "0.16.0", "oyejorge/less.php": "1.7.0.10", "php": ">=5.5.9", "psr/log": "1.0.0", diff --git a/resources/lib/oojs-ui/i18n/nan.json b/resources/lib/oojs-ui/i18n/nan.json new file mode 100644 index 0000000000..7fdf532cc3 --- /dev/null +++ b/resources/lib/oojs-ui/i18n/nan.json @@ -0,0 +1,17 @@ +{ + "@metadata": { + "authors": [ + "Luuva" + ] + }, + "ooui-dialog-message-accept": "Liáu-kái", + "ooui-dialog-message-reject": "Chhú-siau", + "ooui-dialog-process-error": "Ū mi̍h bô hó-sè", + "ooui-dialog-process-dismiss": "Koaiⁿ tiāu", + "ooui-dialog-process-retry": "Koh chhì khòaⁿ-māi", + "ooui-dialog-process-continue": "Kè-sio̍k", + "ooui-selectfile-button-select": "Soán-tek 1-ê tóng-àn", + "ooui-selectfile-not-supported": "Só͘ soán ê tóng-àn bô siū chi-chhî", + "ooui-selectfile-placeholder": "Iáu-bē soán tóng-àn", + "ooui-selectfile-dragdrop-placeholder": "Kā tóng-àn tàn chia" +} diff --git a/resources/lib/oojs-ui/oojs-ui-apex.js b/resources/lib/oojs-ui/oojs-ui-apex.js index 58b0ed0719..a32660a00d 100644 --- a/resources/lib/oojs-ui/oojs-ui-apex.js +++ b/resources/lib/oojs-ui/oojs-ui-apex.js @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.15.4 + * OOjs UI v0.16.0 * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2016 OOjs UI Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2016-02-17T02:03:23Z + * Date: 2016-02-22T22:33:33Z */ ( function ( OO ) { diff --git a/resources/lib/oojs-ui/oojs-ui-core-apex.css b/resources/lib/oojs-ui/oojs-ui-core-apex.css index 633c5584b3..6d9dbd882b 100644 --- a/resources/lib/oojs-ui/oojs-ui-core-apex.css +++ b/resources/lib/oojs-ui/oojs-ui-core-apex.css @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.15.4 + * OOjs UI v0.16.0 * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2016 OOjs UI Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2016-02-17T02:03:27Z + * Date: 2016-02-22T22:33:37Z */ .oo-ui-element-hidden { display: none !important; @@ -264,6 +264,9 @@ .oo-ui-indicatorElement.oo-ui-indicatorElement-indicator { opacity: 0.8; } +.oo-ui-labelElement .oo-ui-labelElement-label-highlight { + font-weight: bold; +} .oo-ui-pendingElement-pending { background-image: /* @embed */ url(themes/apex/images/textures/pending.gif); } @@ -739,8 +742,11 @@ width: 100%; max-width: 50em; } +.oo-ui-dropdownInputWidget .oo-ui-dropdownWidget, +.oo-ui-dropdownInputWidget select { + display: block; +} .oo-ui-dropdownInputWidget select { - display: inline-block; width: 100%; resize: none; -webkit-box-sizing: border-box; @@ -786,7 +792,7 @@ } .oo-ui-textInputWidget input, .oo-ui-textInputWidget textarea { - display: inline-block; + display: block; width: 100%; resize: none; -webkit-box-sizing: border-box; @@ -980,7 +986,7 @@ } .oo-ui-dropdownWidget-handle { width: 100%; - display: inline-block; + display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -1089,6 +1095,3 @@ cursor: default; opacity: 0.2; } -.oo-ui-comboBoxInputWidget > .oo-ui-selectWidget { - margin-top: -3px; -} diff --git a/resources/lib/oojs-ui/oojs-ui-core-mediawiki.css b/resources/lib/oojs-ui/oojs-ui-core-mediawiki.css index 2062ec69dd..7c9fffd552 100644 --- a/resources/lib/oojs-ui/oojs-ui-core-mediawiki.css +++ b/resources/lib/oojs-ui/oojs-ui-core-mediawiki.css @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.15.4 + * OOjs UI v0.16.0 * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2016 OOjs UI Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2016-02-17T02:03:27Z + * Date: 2016-02-22T22:33:37Z */ .oo-ui-element-hidden { display: none !important; @@ -366,6 +366,9 @@ background-position: center center; background-repeat: no-repeat; } +.oo-ui-labelElement .oo-ui-labelElement-label-highlight { + font-weight: bold; +} .oo-ui-pendingElement-pending { background-image: /* @embed */ url(themes/mediawiki/images/textures/pending.gif); } @@ -903,8 +906,11 @@ width: 100%; max-width: 50em; } +.oo-ui-dropdownInputWidget .oo-ui-dropdownWidget, +.oo-ui-dropdownInputWidget select { + display: block; +} .oo-ui-dropdownInputWidget select { - display: inline-block; width: 100%; resize: none; -webkit-box-sizing: border-box; @@ -1023,7 +1029,7 @@ } .oo-ui-textInputWidget input, .oo-ui-textInputWidget textarea { - display: inline-block; + display: block; width: 100%; resize: none; -webkit-box-sizing: border-box; @@ -1247,7 +1253,7 @@ } .oo-ui-dropdownWidget-handle { width: 100%; - display: inline-block; + display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; @@ -1324,9 +1330,6 @@ .oo-ui-dropdownWidget.oo-ui-indicatorElement .oo-ui-dropdownWidget-handle .oo-ui-labelElement-label { margin-right: 2em; } -.oo-ui-dropdownWidget .oo-ui-selectWidget { - border-top-color: #ffffff; -} .oo-ui-comboBoxInputWidget { display: inline-block; position: relative; diff --git a/resources/lib/oojs-ui/oojs-ui-core.js b/resources/lib/oojs-ui/oojs-ui-core.js index f0b96d5036..e244037302 100644 --- a/resources/lib/oojs-ui/oojs-ui-core.js +++ b/resources/lib/oojs-ui/oojs-ui-core.js @@ -1,12 +1,12 @@ /*! - * OOjs UI v0.15.4 + * OOjs UI v0.16.0 * https://www.mediawiki.org/wiki/OOjs_UI * * Copyright 2011–2016 OOjs UI Team and other contributors. * Released under the MIT license * http://oojs.mit-license.org * - * Date: 2016-02-17T02:03:23Z + * Date: 2016-02-22T22:33:33Z */ ( function ( OO ) { @@ -253,8 +253,10 @@ OO.ui.debounce = function ( func, wait, immediate ) { if ( immediate && !timeout ) { func.apply( context, args ); } - clearTimeout( timeout ); - timeout = setTimeout( later, wait ); + if ( !timeout || wait ) { + clearTimeout( timeout ); + timeout = setTimeout( later, wait ); + } }; }; @@ -264,7 +266,7 @@ OO.ui.debounce = function ( func, wait, immediate ) { * @param {HTMLElement} node * @param {string} eventName * @param {Function} handler - * @deprecated + * @deprecated since 0.15.0 */ OO.ui.addCaptureEventListener = function ( node, eventName, handler ) { node.addEventListener( eventName, handler, true ); @@ -276,7 +278,7 @@ OO.ui.addCaptureEventListener = function ( node, eventName, handler ) { * @param {HTMLElement} node * @param {string} eventName * @param {Function} handler - * @deprecated + * @deprecated since 0.15.0 */ OO.ui.removeCaptureEventListener = function ( node, eventName, handler ) { node.removeEventListener( eventName, handler, true ); @@ -2636,8 +2638,6 @@ OO.ui.mixin.IndicatorElement.prototype.getIndicatorTitle = function () { * as a plaintext string, a jQuery selection of elements, or a function that will produce a string * in the future. See the [OOjs UI documentation on MediaWiki] [2] for examples. * [2]: https://www.mediawiki.org/wiki/OOjs_UI/Widgets/Icons,_Indicators,_and_Labels#Labels - * @cfg {boolean} [autoFitLabel=true] Fit the label to the width of the parent element. - * The label will be truncated to fit if necessary. */ OO.ui.mixin.LabelElement = function OoUiMixinLabelElement( config ) { // Configuration initialization @@ -2646,7 +2646,6 @@ OO.ui.mixin.LabelElement = function OoUiMixinLabelElement( config ) { // Properties this.$label = null; this.label = null; - this.autoFitLabel = config.autoFitLabel === undefined || !!config.autoFitLabel; // Initialization this.setLabel( config.label || this.constructor.static.label ); @@ -2677,6 +2676,33 @@ OO.initClass( OO.ui.mixin.LabelElement ); */ OO.ui.mixin.LabelElement.static.label = null; +/* Static methods */ + +/** + * Highlight the first occurrence of the query in the given text + * + * @param {string} text Text + * @param {string} query Query to find + * @return {jQuery} Text with the first match of the query + * sub-string wrapped in highlighted span + */ +OO.ui.mixin.LabelElement.static.highlightQuery = function ( text, query ) { + var $result = $( '' ), + offset = text.toLowerCase().indexOf( query.toLowerCase() ); + + if ( !query.length || offset === -1 ) { + return $result.text( text ); + } + $result.append( + document.createTextNode( text.slice( 0, offset ) ), + $( '' ) + .addClass( 'oo-ui-labelElement-label-highlight' ) + .text( text.slice( offset, offset + query.length ) ), + document.createTextNode( text.slice( offset + query.length ) ) + ); + return $result.contents(); +}; + /* Methods */ /** @@ -2722,6 +2748,17 @@ OO.ui.mixin.LabelElement.prototype.setLabel = function ( label ) { return this; }; +/** + * Set the label as plain text with a highlighted query + * + * @param {string} text Text label to set + * @param {string} query Substring of text to highlight + * @chainable + */ +OO.ui.mixin.LabelElement.prototype.setHighlightedQuery = function ( text, query ) { + return this.setLabel( this.constructor.static.highlightQuery( text, query ) ); +}; + /** * Get the label. * @@ -2736,12 +2773,9 @@ OO.ui.mixin.LabelElement.prototype.getLabel = function () { * Fit the label. * * @chainable + * @deprecated since 0.16.0 */ OO.ui.mixin.LabelElement.prototype.fitLabel = function () { - if ( this.$label && this.$label.autoEllipsis && this.autoFitLabel ) { - this.$label.autoEllipsis( { hasSpan: false, tooltip: true } ); - } - return this; }; @@ -5866,7 +5900,6 @@ OO.ui.MenuSelectWidget = function OoUiMenuSelectWidget( config ) { OO.ui.mixin.ClippableElement.call( this, $.extend( {}, config, { $clippable: this.$group } ) ); // Properties - this.newItems = null; this.autoHide = config.autoHide === undefined || !!config.autoHide; this.filterFromInput = !!config.filterFromInput; this.$input = config.$input ? config.$input : config.input ? config.input.$input : null; @@ -6032,26 +6065,9 @@ OO.ui.MenuSelectWidget.prototype.chooseItem = function ( item ) { * @inheritdoc */ OO.ui.MenuSelectWidget.prototype.addItems = function ( items, index ) { - var i, len, item; - // Parent method OO.ui.MenuSelectWidget.parent.prototype.addItems.call( this, items, index ); - // Auto-initialize - if ( !this.newItems ) { - this.newItems = []; - } - - for ( i = 0, len = items.length; i < len; i++ ) { - item = items[ i ]; - if ( this.isVisible() ) { - // Defer fitting label until item has been attached - item.fitLabel(); - } else { - this.newItems.push( item ); - } - } - // Reevaluate clipping this.clip(); @@ -6088,7 +6104,7 @@ OO.ui.MenuSelectWidget.prototype.clearItems = function () { * @inheritdoc */ OO.ui.MenuSelectWidget.prototype.toggle = function ( visible ) { - var i, len, change; + var change; visible = ( visible === undefined ? !this.visible : !!visible ) && !!this.items.length; change = visible !== this.isVisible(); @@ -6101,12 +6117,6 @@ OO.ui.MenuSelectWidget.prototype.toggle = function ( visible ) { this.bindKeyDownListener(); this.bindKeyPressListener(); - if ( this.newItems && this.newItems.length ) { - for ( i = 0, len = this.newItems.length; i < len; i++ ) { - this.newItems[ i ].fitLabel(); - } - this.newItems = null; - } this.toggleClipping( true ); if ( this.getSelectedItem() ) { @@ -6851,7 +6861,7 @@ OO.ui.InputWidget.prototype.getValue = function () { /** * Set the directionality of the input, either RTL (right-to-left) or LTR (left-to-right). * - * @deprecated since v0.13.1, use #setDir directly + * @deprecated since v0.13.1; use #setDir directly * @param {boolean} isRTL Directionality is right-to-left * @chainable */ @@ -7184,7 +7194,7 @@ OO.ui.CheckboxInputWidget.static.gatherPreInfuseState = function ( node, config * @protected */ OO.ui.CheckboxInputWidget.prototype.getInputElement = function () { - return $( '' ); + return $( '' ).attr( 'type', 'checkbox' ); }; /** @@ -7314,7 +7324,7 @@ OO.ui.DropdownInputWidget.prototype.getInputElement = function ( config ) { if ( config.$input ) { return config.$input.addClass( 'oo-ui-element-hidden' ); } - return $( '' ); + return $( '' ).attr( 'type', 'hidden' ); }; /** @@ -7476,7 +7486,7 @@ OO.ui.RadioInputWidget.static.gatherPreInfuseState = function ( node, config ) { * @protected */ OO.ui.RadioInputWidget.prototype.getInputElement = function () { - return $( '' ); + return $( '' ).attr( 'type', 'radio' ); }; /** @@ -7591,7 +7601,7 @@ OO.ui.RadioSelectInputWidget.static.gatherPreInfuseState = function ( node, conf * @protected */ OO.ui.RadioSelectInputWidget.prototype.getInputElement = function () { - return $( '' ); + return $( '' ).attr( 'type', 'hidden' ); }; /** @@ -8133,7 +8143,7 @@ OO.ui.TextInputWidget.prototype.adjustSize = function () { OO.ui.TextInputWidget.prototype.getInputElement = function ( config ) { return config.multiline ? $( '