Merge "jquery.tablesorter: Silence an expected "sort-rowspan-error" warning"
[mediawiki.git] / resources / src / mediawiki.special.apisandbox / UploadSelectFileParamWidget.js
blobd234ff6aed46740050dcff5fb51a201eadbbbe1f
1 /**
2 * A wrapper for OO.ui.SelectFileInputWidget
4 * @class
5 * @private
6 * @constructor
7 */
8 function UploadSelectFileParamWidget() {
9 UploadSelectFileParamWidget.super.call( this );
12 OO.inheritClass( UploadSelectFileParamWidget, OO.ui.SelectFileInputWidget );
14 /**
15 * @return {string}
17 UploadSelectFileParamWidget.prototype.getApiValueForDisplay = function () {
18 return '...';
21 /**
22 * @return {boolean}
24 UploadSelectFileParamWidget.prototype.requiresFormData = function () {
25 return true;
28 /**
29 * @return {any}
31 UploadSelectFileParamWidget.prototype.getApiValue = function () {
32 return this.getValue();
35 /**
36 * There should be `@param {any} newValue` but that results in
37 * `no-unused-vars` eslint rule failing
39 UploadSelectFileParamWidget.prototype.setApiValue = function () {
40 // No-op
43 /**
44 * @param {boolean} shouldSuppressErrors
45 * @return {jQuery.Promise}
47 UploadSelectFileParamWidget.prototype.apiCheckValid = function ( shouldSuppressErrors ) {
48 const ok = this.getValue() !== null && this.getValue() !== undefined || shouldSuppressErrors;
49 this.info.setIcon( ok ? null : 'alert' );
50 this.setTitle( ok ? '' : mw.message( 'apisandbox-alert-field' ).plain() );
51 return $.Deferred().resolve( ok ).promise();
54 module.exports = UploadSelectFileParamWidget;