-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30da3f1
commit 86cbf06
Showing
9 changed files
with
309 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,38 @@ | ||
import {Component, Input, ViewEncapsulation} from '@angular/core'; | ||
import {Component, ElementRef, Input, NgZone, OnInit, ViewEncapsulation} from '@angular/core'; | ||
|
||
import {Observable} from 'rxjs'; | ||
import {take} from 'rxjs/operators'; | ||
|
||
import {ngbRunTransition} from '../util/transition/ngbTransition'; | ||
|
||
@Component({ | ||
selector: 'ngb-modal-backdrop', | ||
encapsulation: ViewEncapsulation.None, | ||
template: '', | ||
host: | ||
{'[class]': '"modal-backdrop fade show" + (backdropClass ? " " + backdropClass : "")', 'style': 'z-index: 1050'} | ||
host: { | ||
'[class]': '"modal-backdrop" + (backdropClass ? " " + backdropClass : "")', | ||
'[class.show]': '!animation', | ||
'[class.fade]': 'animation', | ||
'style': 'z-index: 1050' | ||
} | ||
}) | ||
export class NgbModalBackdrop { | ||
export class NgbModalBackdrop implements OnInit { | ||
@Input() animation: boolean; | ||
@Input() backdropClass: string; | ||
|
||
constructor(private _el: ElementRef<HTMLElement>, private _zone: NgZone) {} | ||
|
||
ngOnInit() { | ||
this._zone.onStable.asObservable().pipe(take(1)).subscribe(() => { | ||
ngbRunTransition( | ||
this._el.nativeElement, ({classList}) => classList.add('show'), | ||
{animation: this.animation, runningTransition: 'continue'}); | ||
}); | ||
} | ||
|
||
hide(): Observable<void> { | ||
return ngbRunTransition( | ||
this._el.nativeElement, ({classList}) => classList.remove('show'), | ||
{animation: this.animation, runningTransition: 'stop'}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.