1+ "use strict" ;
2+
3+ Object . defineProperty ( exports , "__esModule" , {
4+ value : true
5+ } ) ;
6+
7+ var _typeof = typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ? function ( obj ) { return typeof obj ; } : function ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ;
8+
9+ var changePage = function changePage ( goToPage , options ) {
10+ var fthis = undefined ;
11+ try {
12+ if ( goToPage && undefined . props . children . filter ( function ( x ) {
13+ return x . key === goToPage ;
14+ } ) . length === 0 ) {
15+ if ( fthis . props . errorPageKey ) {
16+ goToPage = fthis . props . errorPageKey ;
17+ } else {
18+ goToPage = undefined . state . homePageKey ;
19+ }
20+ console . error ( "goToPage " , goToPage , " undefined" ) ;
21+ fthis . onError ( "page undefined" ) ;
22+ }
23+
24+ //סיום האפליקציה, סגור
25+ if ( undefined . state . historyPages . length === 1 && goToPage === undefined ) {
26+ console . log ( '"window.navigator.app.exitApp()"' ) ;
27+ // fthis.showSwalLater ?
28+ // fthis.myChildrens.swal.runSwal(true) :
29+ if ( undefined . props . beforExit ) if ( ! undefined . props . beforExit ( ) ) return ;
30+ window . navigator . app . exitApp ( ) ;
31+ return ;
32+ }
33+
34+ if ( goToPage === undefined ) {
35+ console . error ( "navigator error: changePage function need goToPage parameter." ) ;
36+ return ;
37+ }
38+
39+ if ( fthis . listLevelPages [ goToPage ] === undefined ) {
40+ console . error ( "navigator error, at changePage. goToPage parameter not found in the pages list." ) ;
41+ return ;
42+ }
43+
44+ undefined . props . children . filter ( function ( child ) {
45+ return ( typeof child === "undefined" ? "undefined" : _typeof ( child ) ) === "object" ;
46+ } ) . forEach ( function ( child ) {
47+ if ( child . props . kill ) {
48+ fthis . historyPages = fthis . historyPages . filter ( function ( x ) {
49+ return x !== child . key ;
50+ } ) ;
51+ }
52+ } ) ;
53+
54+ undefined . setState ( { historyPages : undefined . historyPages } ) ;
55+
56+ var fromPage = "" + undefined . historyPages [ undefined . historyPages . length - 1 ] + "" ;
57+
58+ var aniTime = 250 ;
59+
60+ if ( undefined . props . children . filter ( function ( x ) {
61+ return x . key === goToPage ;
62+ } ) [ 0 ] . props . animationTimeInMS ) {
63+ aniTime = undefined . props . children . filter ( function ( x ) {
64+ return x . key === goToPage ;
65+ } ) [ 0 ] . props . animationTimeInMS ;
66+ } else {
67+ if ( undefined . props . animationTimeInMS ) aniTime = undefined . props . animationTimeInMS ;
68+ }
69+
70+ options = options === undefined ? [ ] : options ;
71+
72+ var _options = options ,
73+ _options$props = _options . props ,
74+ props = _options$props === undefined ? null : _options$props ,
75+ _options$animationIn = _options . animationIn ,
76+ animationIn = _options$animationIn === undefined ? undefined . componentTransitionIn [ goToPage ] ? undefined . componentTransitionIn [ goToPage ] : null : _options$animationIn ,
77+ _options$timeAnimatio = _options . timeAnimationInMS ,
78+ timeAnimationInMS = _options$timeAnimatio === undefined ? aniTime : _options$timeAnimatio ,
79+ _options$animationOut = _options . animationOut ,
80+ animationOut = _options$animationOut === undefined ? undefined . swipeRight ? "slideOutRight" : undefined . componentTransitionOut [ fromPage ] ? undefined . componentTransitionOut [ fromPage ] : null : _options$animationOut ,
81+ _options$callbackFun = _options . callbackFun ,
82+ callbackFun = _options$callbackFun === undefined ? null : _options$callbackFun ;
83+
84+
85+ if ( props !== null ) {
86+ // let oldProps = this.state.props;
87+ var newProps = [ ] ;
88+ newProps [ goToPage ] = props ;
89+ undefined . setState ( { props : newProps } ) ;
90+ } else { }
91+
92+ if ( ! undefined . busy ) {
93+ // const fthis = this;
94+
95+ //--animation time defult
96+ var timeAnimation = timeAnimationInMS ; //param.timeAnimationInMS !== undefined && param.timeAnimationInMS !== null ? param.timeAnimationInMS :
97+ // 250; //ms
98+
99+ if ( goToPage !== fromPage ) {
100+ //---ניהול חזרות----//
101+ undefined . busy = true ;
102+
103+ ///שמור היסטוריה
104+ var new_historyPages = undefined . state . historyPages . slice ( ) ;
105+
106+ if ( undefined . listLevelPages [ goToPage ] <= undefined . listLevelPages [ fromPage ] ) {
107+ //חוזרים אחורה, מחק את כל הדפים שהרמה שלהם גבוהה משלי.
108+ //new_historyPages.splice(new_historyPages.length - 1, 1);
109+ new_historyPages = new_historyPages . filter ( function ( x ) {
110+ return undefined . listLevelPages [ x ] < undefined . listLevelPages [ goToPage ] ;
111+ } ) ;
112+ }
113+ new_historyPages . push ( goToPage ) ;
114+ //שמירת שינויים בהיסטוריה
115+ undefined . setState ( { historyPages : new_historyPages } ) ;
116+
117+ if ( undefined . state . changeRoute ) {
118+ window . location . href = window . location . href . substr ( 0 , window . location . href . lastIndexOf ( "/" ) + 1 ) + "#" + ( goToPage !== undefined . state . homePageKey ? goToPage : "" ) ;
119+ }
120+
121+ //----navigator and animation----///
122+
123+ if ( undefined . listLevelPages [ goToPage ] > undefined . listLevelPages [ fromPage ] ) {
124+ //--נכנסים דף פנימה Up--//
125+ undefined . funAnimationIn1 ( goToPage , fromPage ) ;
126+
127+ if ( undefined . listLevelPages [ goToPage ] === 1 ) {
128+ //Up from level 0 to level 1
129+ console . log ( "goToPage: " , goToPage ) ;
130+ // debugger
131+ $ ( "#" + goToPage ) . css ( "animation" , ( animationIn !== null && animationIn !== undefined ? animationIn : "slideInRight" ) + " " + timeAnimation + "ms" ) ;
132+ } else {
133+ //else if (this.listLevelPages[goToPage] === 2) {
134+ //Up from level 1 to level 2
135+ $ ( "#" + goToPage ) . css ( "animation" , ( animationIn !== null && animationIn !== undefined ? animationIn : "zoomIn" ) + " " + timeAnimation + "ms" ) ;
136+ }
137+ } else {
138+ //--חזרה בדפים Down--//
139+ undefined . funAnimationOut1 ( goToPage , fromPage ) ;
140+ if ( undefined . listLevelPages [ fromPage ] === 1 ) {
141+ //Down from level 1 to level 0
142+ $ ( "#" + fromPage ) . css ( "animation" , ( animationOut !== null && animationOut !== undefined ? animationOut : "slideOutRight" ) + " " + timeAnimation + "ms" ) ;
143+ } else {
144+ //else if (this.listLevelPages[goToPage] === 1) {
145+ //Down from level 2 to level 1
146+ $ ( "#" + fromPage ) . css ( "animation" , ( animationOut !== null && animationOut !== undefined ? animationOut : "zoomOut" ) + " " + timeAnimation + "ms" ) ;
147+ }
148+ }
149+ // //עיצוב כפתור חזרה
150+ // if (goToPage === "home") {
151+ // $('#navigatorBack').css('display', "none");
152+ // } else {
153+ // $('#navigatorBack').css('display', "flex");
154+ // }
155+
156+ if ( callbackFun !== undefined && callbackFun !== null ) callbackFun ( ) ;
157+ }
158+ }
159+ } catch ( error ) {
160+ console . error ( error ) ;
161+ debugger ;
162+ return ;
163+ fthis . onError ( error ) ;
164+ }
165+ } ;
166+
167+ exports . default = changePage ;
0 commit comments