@@ -56,19 +56,19 @@ const EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`
5656const EVENT_LOAD_DATA_API = `load${ EVENT_KEY } ${ DATA_API_KEY } `
5757const EVENT_CLICK_DATA_API = `click${ EVENT_KEY } ${ DATA_API_KEY } `
5858
59- const CLASS_NAME_CALENDAR = 'calendar'
6059const CLASS_NAME_CALENDAR_CELL = 'calendar-cell'
6160const CLASS_NAME_CALENDAR_CELL_INNER = 'calendar-cell-inner'
6261const CLASS_NAME_CALENDAR_ROW = 'calendar-row'
62+ const CLASS_NAME_CALENDARS = 'calendars'
6363
6464const SELECTOR_BTN_DOUBLE_NEXT = '.btn-double-next'
6565const SELECTOR_BTN_DOUBLE_PREV = '.btn-double-prev'
6666const SELECTOR_BTN_MONTH = '.btn-month'
6767const SELECTOR_BTN_NEXT = '.btn-next'
6868const SELECTOR_BTN_PREV = '.btn-prev'
6969const SELECTOR_BTN_YEAR = '.btn-year'
70+ const SELECTOR_CALENDAR = '.calendar'
7071const SELECTOR_CALENDAR_CELL = '.calendar-cell'
71- const SELECTOR_CALENDAR_PANEL = '.calendar-panel'
7272const SELECTOR_CALENDAR_ROW = '.calendar-row'
7373const SELECTOR_DATA_TOGGLE = '[data-coreui-toggle="calendar"]'
7474
@@ -207,7 +207,7 @@ class Calendar extends BaseComponent {
207207 const target = event . target . classList . contains ( CLASS_NAME_CALENDAR_CELL_INNER ) ? event . target . parentElement : event . target
208208 const date = this . _getDate ( target )
209209 const cloneDate = new Date ( date )
210- const index = Manipulator . getDataAttribute ( target . closest ( SELECTOR_CALENDAR_PANEL ) , 'calendar-index' )
210+ const index = Manipulator . getDataAttribute ( target . closest ( SELECTOR_CALENDAR ) , 'calendar-index' )
211211
212212 if ( isDateDisabled ( date , this . _config . minDate , this . _config . maxDate , this . _config . disabledDates ) ) {
213213 return
@@ -305,7 +305,7 @@ class Calendar extends BaseComponent {
305305 setTimeout ( ( ) => {
306306 const _list = SelectorEngine . find (
307307 'td[tabindex="0"], tr[tabindex="0"]' ,
308- SelectorEngine . find ( '.calendar-panel ' , this . _element ) . pop ( )
308+ SelectorEngine . find ( '.calendar' , this . _element ) . pop ( )
309309 )
310310
311311 if ( _list . length && key === ARROW_RIGHT_KEY ) {
@@ -573,7 +573,7 @@ class Calendar extends BaseComponent {
573573 const month = calendarDate . getMonth ( )
574574
575575 const calendarPanelEl = document . createElement ( 'div' )
576- calendarPanelEl . classList . add ( 'calendar-panel ' )
576+ calendarPanelEl . classList . add ( 'calendar' )
577577
578578 Manipulator . setDataAttribute ( calendarPanelEl , 'calendar-index' , order )
579579
@@ -724,23 +724,19 @@ class Calendar extends BaseComponent {
724724 }
725725
726726 _createCalendar ( ) {
727- const calendarsEl = document . createElement ( 'div' )
728- calendarsEl . classList . add ( 'calendars' )
729-
730727 if ( this . _config . selectionType && this . _view === 'days' ) {
731- calendarsEl . classList . add ( `select-${ this . _config . selectionType } ` )
728+ this . _element . classList . add ( `select-${ this . _config . selectionType } ` )
732729 }
733730
734731 if ( this . _config . showWeekNumber ) {
735- calendarsEl . classList . add ( 'show-week-numbers' )
732+ this . _element . classList . add ( 'show-week-numbers' )
736733 }
737734
738735 for ( const [ index , _ ] of Array . from ( { length : this . _config . calendars } ) . entries ( ) ) {
739- calendarsEl . append ( this . _createCalendarPanel ( index ) )
736+ this . _element . append ( this . _createCalendarPanel ( index ) )
740737 }
741738
742- this . _element . classList . add ( CLASS_NAME_CALENDAR )
743- this . _element . append ( calendarsEl )
739+ this . _element . classList . add ( CLASS_NAME_CALENDARS )
744740 }
745741
746742 _updateCalendar ( callback ) {
0 commit comments