@@ -47,6 +47,7 @@ const CLASS_NAME_CALENDAR = 'date-picker-calendar'
47
47
const CLASS_NAME_CALENDARS = 'date-picker-calendars'
48
48
const CLASS_NAME_CLEANER = 'date-picker-cleaner'
49
49
const CLASS_NAME_DATE_PICKER = 'date-picker'
50
+ const CLASS_NAME_DATE_RANGE_PICKER = 'date-range-picker'
50
51
const CLASS_NAME_DISABLED = 'disabled'
51
52
const CLASS_NAME_DROPDOWN = 'date-picker-dropdown'
52
53
const CLASS_NAME_INDICATOR = 'date-picker-indicator'
@@ -232,8 +233,10 @@ class DateRangePicker extends BaseComponent {
232
233
cancel ( ) {
233
234
this . _endDate = this . _initialEndDate
234
235
this . _endInput . value = this . _setInputValue ( this . _initialEndDate )
236
+ this . _endInput . dispatchEvent ( new Event ( 'change' ) )
235
237
this . _startDate = this . _initialStartDate
236
238
this . _startInput . value = this . _setInputValue ( this . _initialStartDate )
239
+ this . _startInput . dispatchEvent ( new Event ( 'change' ) )
237
240
this . _calendars . innerHTML = ''
238
241
if ( this . _config . timepicker ) {
239
242
this . _timepickers . innerHTML = ''
@@ -247,8 +250,10 @@ class DateRangePicker extends BaseComponent {
247
250
clear ( ) {
248
251
this . _endDate = null
249
252
this . _endInput . value = ''
253
+ this . _endInput . dispatchEvent ( new Event ( 'change' ) )
250
254
this . _startDate = null
251
255
this . _startInput . value = ''
256
+ this . _startInput . dispatchEvent ( new Event ( 'change' ) )
252
257
this . _calendars . innerHTML = ''
253
258
if ( this . _config . timepicker ) {
254
259
this . _timepickers . innerHTML = ''
@@ -261,8 +266,10 @@ class DateRangePicker extends BaseComponent {
261
266
reset ( ) {
262
267
this . _endDate = this . _config . endDate
263
268
this . _endInput . value = this . _setInputValue ( this . _config . endDate )
269
+ this . _endInput . dispatchEvent ( new Event ( 'change' ) )
264
270
this . _startDate = this . _config . startDate
265
271
this . _startInput . value = this . _setInputValue ( this . _config . startDate )
272
+ this . _startInput . dispatchEvent ( new Event ( 'change' ) )
266
273
this . _calendars . innerHTML = ''
267
274
if ( this . _config . timepicker ) {
268
275
this . _timepickers . innerHTML = ''
@@ -408,6 +415,8 @@ class DateRangePicker extends BaseComponent {
408
415
_createDateRangePicker ( ) {
409
416
this . _element . classList . add ( CLASS_NAME_DATE_PICKER )
410
417
418
+ Manipulator . setDataAttribute ( this . _element , 'toggle' , this . _config . range ? CLASS_NAME_DATE_RANGE_PICKER : CLASS_NAME_DATE_PICKER )
419
+
411
420
if ( this . _config . size ) {
412
421
this . _element . classList . add ( `date-picker-${ this . _config . size } ` )
413
422
}
@@ -493,7 +502,9 @@ class DateRangePicker extends BaseComponent {
493
502
this . _startDate = this . _config . ranges [ key ] [ 0 ]
494
503
this . _endDate = this . _config . ranges [ key ] [ 1 ]
495
504
this . _startInput . value = this . _setInputValue ( this . _startDate )
505
+ this . _startInput . dispatchEvent ( new Event ( 'change' ) )
496
506
this . _endInput . value = this . _setInputValue ( this . _endDate )
507
+ this . _endInput . dispatchEvent ( new Event ( 'change' ) )
497
508
this . _updateDateRangePickerCalendars ( )
498
509
} )
499
510
@@ -645,7 +656,9 @@ class DateRangePicker extends BaseComponent {
645
656
this . _startDate = date
646
657
this . _endDate = date
647
658
this . _endInput . value = this . _setInputValue ( date )
659
+ this . _endInput . dispatchEvent ( new Event ( 'change' ) )
648
660
this . _startInput . value = this . _setInputValue ( date )
661
+ this . _startInput . dispatchEvent ( new Event ( 'change' ) )
649
662
this . _updateDateRangePickerCalendars ( )
650
663
} )
651
664
0 commit comments