Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4038437
ParamWidget.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
ParamWidget.js
View Options
/**
* TemplateData Param Widget
*
* @class
* @extends OO.ui.DecoratedOptionWidget
* @mixes OO.ui.mixin.DraggableElement
*
* @param {Object} data Parameter data
* @param {Object} [config] Configuration object
*/
function
ParamWidget
(
data
,
config
)
{
config
=
config
||
{};
// Parent constructor
ParamWidget
.
super
.
call
(
this
,
Object
.
assign
(
{},
config
,
{
data
:
data
.
key
,
icon
:
'menu'
}
)
);
// Mixin constructors
OO
.
ui
.
mixin
.
DraggableElement
.
call
(
this
,
$
.
extend
(
{
$handle
:
this
.
$icon
}
)
);
OO
.
ui
.
mixin
.
TabIndexedElement
.
call
(
this
,
{
$tabIndexed
:
this
.
$element
}
);
this
.
key
=
data
.
key
;
this
.
label
=
data
.
label
;
this
.
aliases
=
data
.
aliases
||
[];
this
.
description
=
data
.
description
;
// Events
this
.
$element
.
on
(
'keydown'
,
this
.
onKeyDown
.
bind
(
this
)
);
// Initialize
this
.
$element
.
addClass
(
'tdg-templateDataParamWidget'
);
this
.
buildParamLabel
();
}
/* Inheritance */
OO
.
inheritClass
(
ParamWidget
,
OO
.
ui
.
DecoratedOptionWidget
);
OO
.
mixinClass
(
ParamWidget
,
OO
.
ui
.
mixin
.
DraggableElement
);
OO
.
mixinClass
(
ParamWidget
,
OO
.
ui
.
mixin
.
TabIndexedElement
);
/**
* @param {jQuery.Event} e Key down event
* @fires choose
*/
ParamWidget
.
prototype
.
onKeyDown
=
function
(
e
)
{
if
(
e
.
which
===
OO
.
ui
.
Keys
.
ENTER
)
{
this
.
emit
(
'choose'
,
this
);
}
};
/**
* Build the parameter label in the parameter select widget
*/
ParamWidget
.
prototype
.
buildParamLabel
=
function
()
{
const
keys
=
this
.
aliases
.
slice
(),
$paramLabel
=
$
(
'<div>'
)
.
addClass
(
'tdg-templateDataParamWidget-param-name'
),
$aliases
=
$
(
'<div>'
)
.
addClass
(
'tdg-templateDataParamWidget-param-aliases'
),
$description
=
$
(
'<div>'
)
.
addClass
(
'tdg-templateDataParamWidget-param-description'
);
keys
.
unshift
(
this
.
key
);
$paramLabel
.
text
(
this
.
label
||
this
.
key
);
$description
.
text
(
this
.
description
);
keys
.
forEach
(
(
key
)
=>
{
$aliases
.
append
(
$
(
'<span>'
)
.
addClass
(
'tdg-templateDataParamWidget-param-alias'
)
.
text
(
key
)
);
}
);
this
.
setLabel
(
$aliases
.
add
(
$paramLabel
).
add
(
$description
)
);
};
module
.
exports
=
ParamWidget
;
File Metadata
Details
Attached
Mime Type
text/x-asm
Expires
Aug 15 2026, 04:20 (12 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a5/cc/7798af4245df46ddd53e66972fa7
Default Alt Text
ParamWidget.js (2 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment