1 const ValuePickerWidget = require( './ValuePickerWidget.js' );
4 * Widget defining the popup to choose date for the results.
6 * @class mw.rcfilters.ui.DatePopupWidget
8 * @extends OO.ui.Widget
10 * @param {mw.rcfilters.dm.FilterGroup} model Group model for 'days'
11 * @param {Object} [config] Configuration object
13 const DatePopupWidget = function MwRcfiltersUiDatePopupWidget( model, config ) {
14 config = config || {};
17 DatePopupWidget.super.call( this, config );
19 OO.ui.mixin.LabelElement.call( this, config );
23 this.hoursValuePicker = new ValuePickerWidget(
26 classes: [ 'mw-rcfilters-ui-datePopupWidget-hours' ],
27 label: mw.msg( 'rcfilters-hours-title' ),
28 itemFilter: function ( itemModel ) {
29 return Number( itemModel.getParamName() ) < 1;
33 this.hoursValuePicker.selectWidget.$element.attr( 'aria-label', mw.msg( 'rcfilters-hours-title' ) );
35 this.daysValuePicker = new ValuePickerWidget(
38 classes: [ 'mw-rcfilters-ui-datePopupWidget-days' ],
39 label: mw.msg( 'rcfilters-days-title' ),
40 itemFilter: function ( itemModel ) {
41 return Number( itemModel.getParamName() ) >= 1;
45 this.daysValuePicker.selectWidget.$element.attr( 'aria-label', mw.msg( 'rcfilters-days-title' ) );
48 this.hoursValuePicker.connect( this, { choose: [ 'emit', 'days' ] } );
49 this.daysValuePicker.connect( this, { choose: [ 'emit', 'days' ] } );
53 .addClass( 'mw-rcfilters-ui-datePopupWidget' )
56 .addClass( 'mw-rcfilters-ui-datePopupWidget-title' ),
57 this.hoursValuePicker.$element,
58 this.daysValuePicker.$element
64 OO.inheritClass( DatePopupWidget, OO.ui.Widget );
65 OO.mixinClass( DatePopupWidget, OO.ui.mixin.LabelElement );
70 * A days item was chosen
73 * @param {string} name Item name
77 module.exports = DatePopupWidget;