3 * A group widget to allow for aggregation of events
5 * @class mw.rcfilters.ui.GroupWidget
6 * @extends OO.ui.Widget
9 * @param {Object} [config] Configuration object
10 * @param {Object} [events] Events to aggregate. The object represent the
11 * event name to aggregate and the event value to emit on aggregate for items.
13 var GroupWidget
= function MwRcfiltersUiViewSwitchWidget( config
) {
16 config
= config
|| {};
19 GroupWidget
.parent
.call( this, config
);
22 OO
.ui
.mixin
.GroupElement
.call( this, $.extend( {}, config
, { $group
: this.$element
} ) );
24 if ( config
.events
) {
26 // eslint-disable-next-line no-jquery/no-each-util
27 $.each( config
.events
, function ( eventName
, eventEmit
) {
28 aggregate
[ eventName
] = eventEmit
;
31 this.aggregate( aggregate
);
34 if ( Array
.isArray( config
.items
) ) {
35 this.addItems( config
.items
);
41 OO
.inheritClass( GroupWidget
, OO
.ui
.Widget
);
42 OO
.mixinClass( GroupWidget
, OO
.ui
.mixin
.GroupWidget
);
44 module
.exports
= GroupWidget
;