Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4121904
LimitParamWidget.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
LimitParamWidget.js
View Options
const
TextParamMixin
=
require
(
'./TextParamMixin.js'
);
/**
* A wrapper for OO.ui.TextInputWidget
*
* @class
* @private
* @constructor
* @param {Object} config Configuration options
*/
function
LimitParamWidget
(
config
)
{
LimitParamWidget
.
super
.
call
(
this
,
config
);
}
OO
.
inheritClass
(
LimitParamWidget
,
OO
.
ui
.
TextInputWidget
);
OO
.
mixinClass
(
LimitParamWidget
,
TextParamMixin
);
/**
* For a limit parameter, a value can either be "max" or a number
* that is
* - not NaN (not "Not-A-Number")
* - finite
* - not a decimal (identical to Math.floor with that number)
* - at least the minimum set in paramInfo.min
* - at most the maximum set in paramInfo.apiSandboxMax
*
* this.paramInfo should be set by the code using this widget, and
* should have `min` and `apiSandboxMax` set as intergers
*
* @param {string} value
* @return {boolean}
*/
LimitParamWidget
.
prototype
.
validate
=
function
(
value
)
{
let
n
;
if
(
value
===
'max'
)
{
return
true
;
}
else
{
n
=
+
value
;
return
!
isNaN
(
n
)
&&
isFinite
(
n
)
&&
Math
.
floor
(
n
)
===
n
&&
n
>=
this
.
paramInfo
.
min
&&
n
<=
this
.
paramInfo
.
apiSandboxMax
;
}
};
module
.
exports
=
LimitParamWidget
;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Aug 19, 05:02 (1 d, 9 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
5f/70/71d117896ea714bb28ac156e3fec
Default Alt Text
LimitParamWidget.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment