forked from EVOgeek/Vmeda.Online
		
	MOBILE-3833 collapsible: Do not init collapsible heading if not needed
This commit is contained in:
		
							parent
							
								
									46dd468314
								
							
						
					
					
						commit
						bc2e38dece
					
				| @ -1,4 +1,4 @@ | |||||||
| <ion-header collapsible> | <ion-header [collapsible]="!subfolder"> | ||||||
|     <ion-toolbar> |     <ion-toolbar> | ||||||
|         <ion-buttons slot="start"> |         <ion-buttons slot="start"> | ||||||
|             <ion-back-button [text]="'core.back' | translate"></ion-back-button> |             <ion-back-button [text]="'core.back' | translate"></ion-back-button> | ||||||
|  | |||||||
| @ -1,4 +1,4 @@ | |||||||
| <ion-header collapsible> | <ion-header [collapsible]="!this.pageId && !this.pageTitle"> | ||||||
|     <ion-toolbar> |     <ion-toolbar> | ||||||
|         <ion-buttons slot="start"> |         <ion-buttons slot="start"> | ||||||
|             <ion-back-button [text]="'core.back' | translate"></ion-back-button> |             <ion-back-button [text]="'core.back' | translate"></ion-back-button> | ||||||
|  | |||||||
| @ -88,7 +88,18 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest | |||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|      */ |      */ | ||||||
|     async ngOnInit(): Promise<void> { |     ngOnInit(): void { | ||||||
|  |         this.init(); | ||||||
|  |     } | ||||||
|  | 
 | ||||||
|  |     /** | ||||||
|  |      * Init function. | ||||||
|  |      */ | ||||||
|  |     async init(): Promise<void> { | ||||||
|  |         if (!this.collapsible || this.expandedHeader) { | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         this.initializePage(); |         this.initializePage(); | ||||||
| 
 | 
 | ||||||
|         await Promise.all([ |         await Promise.all([ | ||||||
| @ -104,9 +115,12 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest | |||||||
|     /** |     /** | ||||||
|      * @inheritdoc |      * @inheritdoc | ||||||
|      */ |      */ | ||||||
|     ngOnChanges(changes: {[name: string]: SimpleChange}): void { |     async ngOnChanges(changes: {[name: string]: SimpleChange}): Promise<void> { | ||||||
|         if (changes.collapsible) { |         if (changes.collapsible) { | ||||||
|             this.enabled = !CoreUtils.isFalseOrZero(changes.collapsible.currentValue); |             this.enabled = !CoreUtils.isFalseOrZero(changes.collapsible.currentValue); | ||||||
|  | 
 | ||||||
|  |             await this.init(); | ||||||
|  | 
 | ||||||
|             setTimeout(() => { |             setTimeout(() => { | ||||||
|                 this.setEnabled(this.enabled); |                 this.setEnabled(this.enabled); | ||||||
|             }, 200); |             }, 200); | ||||||
| @ -160,8 +174,10 @@ export class CoreCollapsibleHeaderDirective implements OnInit, OnChanges, OnDest | |||||||
| 
 | 
 | ||||||
|         // Timeout in case event is never fired.
 |         // Timeout in case event is never fired.
 | ||||||
|         const timeout = window.setTimeout(() => { |         const timeout = window.setTimeout(() => { | ||||||
|  |             if (this.firstEnter) { | ||||||
|                 this.firstEnter = false; |                 this.firstEnter = false; | ||||||
|                 this.enteredPromise.reject(new Error('[collapsible-header] Waiting for ionViewDidEnter timeout reached')); |                 this.enteredPromise.reject(new Error('[collapsible-header] Waiting for ionViewDidEnter timeout reached')); | ||||||
|  |             } | ||||||
|         }, 5000); |         }, 5000); | ||||||
| 
 | 
 | ||||||
|         this.resizeListener = CoreDom.onWindowResize(() => { |         this.resizeListener = CoreDom.onWindowResize(() => { | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user