1
+ const CreateDefaultOptions = function ( fn , DefaulTabInnerComponent = null ) {
2
+ this . fn = fn ;
3
+ this . defaultDirection = 'ltr' ;
4
+ this . _DefaulTabInnerComponent = DefaulTabInnerComponent ;
5
+ this . directionsRange = [ 'ltr' , 'rtl' ] ;
6
+ this . _create ( this . _getOptions ( ) ) ;
7
+ } ;
8
+ CreateDefaultOptions . prototype . _create = function ( options ) {
9
+ this . fn . options = options ;
10
+ } ;
11
+ CreateDefaultOptions . prototype . _getOptions = function ( ) {
12
+ const _options = {
13
+ tabs : [ ] ,
14
+ selectedTabID : '' ,
15
+ beforeSelect : function ( e , id ) { return true ; } ,
16
+ beforeClose : function ( e , id ) { return true ; } ,
17
+ onOpen : function ( IDs ) { } ,
18
+ onClose : function ( IDs ) { } ,
19
+ onSelect : function ( { currentSelectedTabId, perviousSelectedTabId } ) { } ,
20
+ onChange : function ( { currentData, perviousData } ) { } ,
21
+ onLoad : function ( api ) { } ,
22
+ onDestroy : function ( ) { } ,
23
+ isCustomTabComponent : false , // shoud be removed
24
+ accessibility : true ,
25
+ defaultPanelComponent : null
26
+ } ;
27
+ let _direction = this . defaultDirection , _tabComponent = this . _DefaulTabInnerComponent ;
28
+ const that = this ;
29
+ Object . defineProperties ( _options , {
30
+ direction : {
31
+ get ( ) { return _direction ; } ,
32
+ set ( value ) {
33
+ if ( that . directionsRange . indexOf ( value ) === - 1 )
34
+ throw 'Invalid direction value! it can be eather of "ltr" or "rtl" ' ;
35
+ _direction = value ;
36
+ }
37
+ } ,
38
+ tabComponent : {
39
+ get ( ) {
40
+ return _tabComponent
41
+ } ,
42
+ set ( fn ) {
43
+ if ( fn && ( typeof fn !== 'function' ) )
44
+ throw 'tabComponent property must be type of a function.' ;
45
+ _options . isCustomTabComponent = fn ? true : false ;
46
+ _tabComponent = fn ? fn : that . _DefaulTabInnerComponent ;
47
+ }
48
+ }
49
+ } ) ;
50
+ return _options ;
51
+ } ;
52
+ export default CreateDefaultOptions ;
0 commit comments