1
|
import {Component, ViewEncapsulation, ComponentRef, ElementRef, Input, EventEmitter, Output} from '@angular/core';
|
2
|
|
3
|
@Component({
|
4
|
selector: 'modal-loading',
|
5
|
template: `
|
6
|
<!--uk-modal="center:true"-->
|
7
|
<div [class]="(!isOpen)?'uk-modal ':'uk-modal uk-open uk-animation-fade'" [open]="!isOpen" tabindex="-1" role="dialog" >
|
8
|
<div class="uk-modal-dialog" role="">
|
9
|
<!--div class="modal-content"-->
|
10
|
|
11
|
<div class="uk-modal-body">
|
12
|
<div >
|
13
|
<h4 class="text-center" >{{message}}</h4>
|
14
|
<!-- <div class="uk-spinner"></div>-->
|
15
|
<div class="uk-animation-fade uk-margin-top uk-width-1-1" role="alert">
|
16
|
<span class="loading-gif uk-align-center" ></span>
|
17
|
</div>
|
18
|
<ng-content></ng-content>
|
19
|
|
20
|
</div>
|
21
|
</div>
|
22
|
|
23
|
</div>
|
24
|
<!--/div-->
|
25
|
</div>
|
26
|
<!--div class="uk-modal uk-open" aria-hidden="false" style="display: block; overflow-y: scroll;">
|
27
|
<div class="uk-modal-dialog" tabindex="">
|
28
|
<div class="uk-modal-spinner"></div>
|
29
|
</div>
|
30
|
</div-->
|
31
|
`,
|
32
|
encapsulation: ViewEncapsulation.None,
|
33
|
})
|
34
|
/**
|
35
|
* API to an open alert window.
|
36
|
*/
|
37
|
export class ModalLoading{
|
38
|
|
39
|
@Input() public message:string ="Loading";
|
40
|
|
41
|
/**
|
42
|
* if the value is true alert will be visible or else it will be hidden.
|
43
|
*/
|
44
|
public isOpen:boolean=false;
|
45
|
/**
|
46
|
* Emitted when a ok button was clicked
|
47
|
* or when Ok method is called.
|
48
|
*/
|
49
|
@Output() public alertOutput:EventEmitter<any> = new EventEmitter();
|
50
|
constructor( public _elementRef: ElementRef){}
|
51
|
/**
|
52
|
* Opens a alert window creating backdrop.
|
53
|
*/
|
54
|
open(){
|
55
|
this.isOpen= true;
|
56
|
}
|
57
|
|
58
|
close(){
|
59
|
this.isOpen = false;
|
60
|
}
|
61
|
}
|