updated save method definition to accept more optional params

This commit is contained in:
Valentin 2022-01-13 12:04:15 +02:00
parent afed414030
commit db7af88b87

View File

@ -6,6 +6,11 @@ import { AutoUnsubscribe, IqserEventTarget } from '../utils';
import { ConfirmOptions } from '../misc';
import { ConfirmationDialogService } from './confirmation-dialog.service';
export interface SaveOptions {
closeAfterSave?: boolean;
addMembers?: boolean;
}
@Directive()
/**
* Extend this component when you want to submit the form after pressing enter.
@ -30,7 +35,7 @@ export abstract class BaseDialogComponent extends AutoUnsubscribe implements OnI
super();
}
abstract save(closeAfterSave?: boolean): void;
abstract save(options?: SaveOptions): void;
ngOnInit(): void {
this.addSubscription = this._dialogRef.backdropClick().subscribe(() => {
@ -78,7 +83,7 @@ export abstract class BaseDialogComponent extends AutoUnsubscribe implements OnI
this._openConfirmDialog().then(result => {
if (result in ConfirmOptions) {
if (result === ConfirmOptions.CONFIRM) {
this.save(true);
this.save({ closeAfterSave: true });
} else {
this._dialogRef.close();
}