File tree Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Expand file tree Collapse file tree 2 files changed +12
-11
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,6 @@ const EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`
29
29
30
30
const CLASS_NAME_SHOW = 'show'
31
31
32
- const SELECTOR_CALENDAR = '.calendar'
33
32
const SELECTOR_DATA_TOGGLE = '[data-coreui-toggle="date-picker"]:not(.disabled):not(:disabled)'
34
33
const SELECTOR_DATA_TOGGLE_SHOWN = `${ SELECTOR_DATA_TOGGLE } .${ CLASS_NAME_SHOW } `
35
34
@@ -65,20 +64,14 @@ class DatePicker extends DateRangePicker {
65
64
}
66
65
67
66
// Overrides
68
- _addCalendarEventListeners ( ) {
69
- super . _addCalendarEventListeners ( )
70
- for ( const calendar of SelectorEngine . find ( SELECTOR_CALENDAR , this . _element ) ) {
71
- EventHandler . on ( calendar , 'startDateChange.coreui.calendar' , event => {
72
- this . _startDate = event . date
73
- this . _startInput . value = this . _setInputValue ( event . date )
74
- this . _selectEndDate = false
75
- this . _calendar . update ( this . _getCalendarConfig ( ) )
67
+ _addEventListeners ( ) {
68
+ super . _addEventListeners ( )
76
69
70
+ EventHandler . on ( this . _element , 'startDateChange.coreui.date-range-picker' , event => {
77
71
EventHandler . trigger ( this . _element , EVENT_DATE_CHANGE , {
78
72
date : event . date
79
73
} )
80
- } )
81
- }
74
+ } )
82
75
}
83
76
84
77
// Static
Original file line number Diff line number Diff line change @@ -323,6 +323,10 @@ class DateRangePicker extends BaseComponent {
323
323
this . _startDate = date
324
324
this . _calendarDate = date
325
325
this . _calendar . update ( this . _getCalendarConfig ( ) )
326
+
327
+ EventHandler . trigger ( this . _element , EVENT_START_DATE_CHANGE , {
328
+ date : date
329
+ } )
326
330
}
327
331
} )
328
332
@@ -361,6 +365,10 @@ class DateRangePicker extends BaseComponent {
361
365
this . _endDate = date
362
366
this . _calendarDate = date
363
367
this . _calendar . update ( this . _getCalendarConfig ( ) )
368
+
369
+ EventHandler . trigger ( this . _element , EVENT_END_DATE_CHANGE , {
370
+ date : value
371
+ } )
364
372
}
365
373
} )
366
374
You can’t perform that action at this time.
0 commit comments