Debian Codegraph @

resources/src/mediawiki.special.apisandbox/UploadSelectFileParamWidget.js

raw symbols SCIP
1 /**
2 * A wrapper for OO.ui.SelectFileInputWidget
3 *
4 * @class
5 * @private
6 * @constructor
7 */
8 function UploadSelectFileParamWidget() {
9 UploadSelectFileParamWidget.super.call( this );
10 }
11
12 OO.inheritClass( UploadSelectFileParamWidget, OO.ui.SelectFileInputWidget );
13
14 /**
15 * @return {string}
16 */
17 UploadSelectFileParamWidget.prototype.getApiValueForDisplay = function () {
18 return '...';
19 };
20
21 /**
22 * @return {boolean}
23 */
24 UploadSelectFileParamWidget.prototype.requiresFormData = function () {
25 return true;
26 };
27
28 /**
29 * @return {any}
30 */
31 UploadSelectFileParamWidget.prototype.getApiValue = function () {
32 return this.getValue();
33 };
34
35 /**
36 * There should be `@param {any} newValue` but that results in
37 * `no-unused-vars` eslint rule failing
38 */
39 UploadSelectFileParamWidget.prototype.setApiValue = function () {
40 // No-op
41 };
42
43 /**
44 * @param {boolean} shouldSuppressErrors
45 * @return {jQuery.Promise}
46 */
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();
52 };
53
54 module.exports = UploadSelectFileParamWidget;