blob: 167df09112d83df25c528a8076d971113d4caf00 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
( function ( mw ) {
/**
* A group widget to allow for aggregation of events
*
* @extends OO.ui.Widget
*
* @constructor
* @param {Object} [config] Configuration object
* @param {Object} [events] Events to aggregate. The object represent the
* event name to aggregate and the event value to emit on aggregate for items.
*/
mw.rcfilters.ui.GroupWidget = function MwRcfiltersUiViewSwitchWidget( config ) {
var aggregate = {};
config = config || {};
// Parent constructor
mw.rcfilters.ui.GroupWidget.parent.call( this, config );
// Mixin constructors
OO.ui.mixin.GroupElement.call( this, $.extend( {}, config, { $group: this.$element } ) );
if ( config.events ) {
// Aggregate events
$.each( config.events, function ( eventName, eventEmit ) {
aggregate[ eventName ] = eventEmit;
} );
this.aggregate( aggregate );
}
if ( Array.isArray( config.items ) ) {
this.addItems( config.items );
}
};
/* Initialize */
OO.inheritClass( mw.rcfilters.ui.GroupWidget, OO.ui.Widget );
OO.mixinClass( mw.rcfilters.ui.GroupWidget, OO.ui.mixin.GroupWidget );
}( mediaWiki ) );
|