7
7
* @param {String } [options.tabDisplay="inline-flex"] - default value is "inline-flex". would be display of tab elements
8
8
* @param {String } [options.containerDisplay="flex"] - default value is "flex". would be display of container element
9
9
*/
10
- export const Api = function ( options ) {
10
+ export const Api = function ( ) {
11
11
const arg = arguments ;
12
12
this . _setOptions ( arg [ 1 ] ) ;
13
13
this . _tablistEl = null ;
14
- const { getElManagementIns } = arg [ 0 ] ( ) ;
14
+ const { getElManagementIns} = arg [ 0 ] ( ) ;
15
15
this . _getElManagementIns = getElManagementIns ;
16
16
this . _tabs = null ;
17
17
this . _tabsCount = null ;
@@ -63,11 +63,11 @@ Api.prototype = {
63
63
_hideTabs : function ( firstHiddenTabIndex , selectedTabInfo , includeSelectedTab ) {
64
64
const hiddenTabs = [ ] ;
65
65
this . _options . containerElement . style . display = 'none' ;
66
- const { index : selectedTabIndex } = selectedTabInfo ;
66
+ const { index : selectedTabIndex } = selectedTabInfo ;
67
67
for ( let i = firstHiddenTabIndex , tabsCount = this . _tabsCount ; i < tabsCount ; i ++ ) {
68
68
if ( includeSelectedTab || i !== selectedTabIndex ) {
69
69
this . _tabs [ i ] . style . display = 'none' ;
70
- hiddenTabs . push ( { el : this . _tabs [ i ] , index : i } ) ;
70
+ hiddenTabs . push ( { el : this . _tabs [ i ] , index : i } ) ;
71
71
}
72
72
}
73
73
this . _showBtn ( ) ;
@@ -79,12 +79,12 @@ Api.prototype = {
79
79
const el = index >= 0 ? tabs [ index ] : null ;
80
80
const overflow = el
81
81
? this . els
82
- . getDistance ( el )
83
- . sub ( this . els . getEl ( this . _options . tablistElement ) . getSpacing ( this . _btnPositionRelativeToTablist ) )
84
- . sub ( this . els . getEl ( this . _options . buttonElement ) . getFullSize ( ) ) . value <= 0
82
+ . getDistance ( el )
83
+ . sub ( this . els . getEl ( this . _options . tablistElement ) . getSpacing ( this . _btnPositionRelativeToTablist ) )
84
+ . sub ( this . els . getEl ( this . _options . buttonElement ) . getFullSize ( ) ) . value <= 0
85
85
: false ;
86
86
const overflowFullSize = overflow ? this . els . getEl ( el ) . getFullSize ( ) : 0 ;
87
- return { index, overflowFullSize } ;
87
+ return { index, overflowFullSize} ;
88
88
} ,
89
89
_validateTabsCount : function ( ) {
90
90
this . _tabs = this . _tablistEl . children ;
@@ -112,16 +112,19 @@ Api.prototype = {
112
112
if ( this . _checkOverflow ( _lastTab ) === false ) {
113
113
return [ ] ;
114
114
}
115
- const selectedTabInfo = this . _setBtnPositionRelativeToTablist ( isVertical , direction ) . _getSelectedTabInfo ( this . _tabs , selectedTabIndex ) ;
115
+ const selectedTabInfo = this . _setBtnPositionRelativeToTablist ( isVertical , direction ) . _getSelectedTabInfo (
116
+ this . _tabs ,
117
+ selectedTabIndex ,
118
+ ) ;
116
119
return this . _validateSliderMinSize ( selectedTabInfo )
117
120
? this . _hideTabs (
118
- this . _findFirstHiddenTabIndexFactory (
121
+ this . _findFirstHiddenTabIndexFactory (
122
+ selectedTabInfo ,
123
+ this . _getSearchBoundries ( selectedTabInfo ) ,
124
+ this . _getOrder ( this . _tabs [ 0 ] , _lastTab ) ,
125
+ ) ,
119
126
selectedTabInfo ,
120
- this . _getSearchBoundries ( selectedTabInfo ) ,
121
- this . _getOrder ( this . _tabs [ 0 ] , _lastTab ) ,
122
- ) ,
123
- selectedTabInfo ,
124
- )
127
+ )
125
128
: this . _hideTabs ( 0 , selectedTabInfo , true ) ;
126
129
} ,
127
130
_validateSliderMinSize : function ( selectedTabInfo ) {
@@ -139,7 +142,7 @@ Api.prototype = {
139
142
: 'desc' ;
140
143
} ,
141
144
_getSearchBoundries : function ( selectedTabInfo ) {
142
- const { overflowFullSize, index : pivotIndex } = selectedTabInfo ;
145
+ const { overflowFullSize, index : pivotIndex } = selectedTabInfo ;
143
146
//if selected tab is not existed
144
147
if ( pivotIndex < 0 ) {
145
148
return [ 0 , this . _tabsCount - 2 ] ;
@@ -181,7 +184,8 @@ Api.prototype = {
181
184
/** set _btnPositionRelativeToTablist and _btnReversePositionRelativeToTablist */
182
185
_setBtnPositionRelativeToTablist : function ( isVertical , dir ) {
183
186
if ( ! this . _btnPositionRelativeToTablist ) {
184
- let pos = '' , reversePos = '' ;
187
+ let pos = '' ,
188
+ reversePos = '' ;
185
189
if ( isVertical == true ) {
186
190
pos = 'Bottom' ; //the Button is rendered below the Tablist
187
191
reversePos = 'Top' ;
0 commit comments