[Library]: Modal: Add stayOpen boolean if on ok clicked must not close the modal

git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-services-library/trunk/ng-openaire-library/src/app@57705 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
k.triantafyllou 2019-11-27 10:08:04 +00:00
parent 8ab8cc7829
commit af9b7ac0ea
1 changed files with 15 additions and 3 deletions

View File

@ -112,20 +112,30 @@ export class AlertModal {
@Input()
public okDisabled: boolean = false;
/**
* If the value is true, a checkbox option will be appeared on the right side of footer
*/
@Input()
public choice: boolean = false;
/**
* if the value is true then on ok clicked, modal will stay open.
*/
public stayOpen: boolean = false;
/**
* Value will be emitted if @choice is true
*/
public select: boolean = false;
/**
* Emitted when a ok button was clicked
* or when Ok method is called.
*/
@Output() public alertOutput: EventEmitter<any> = new EventEmitter();
@Output() public clickOutsideOutput: EventEmitter<any> = new EventEmitter();
@ViewChild('element') element: ElementRef;
constructor(public _elementRef: ElementRef) {
constructor() {
}
/**
@ -139,7 +149,9 @@ export class AlertModal {
* ok method closes the modal and emits modalOutput.
*/
ok() {
this.cancel();
if (!this.stayOpen){
this.cancel();
}
if (!this.choice) {
this.alertOutput.emit(true);
} else {