updated save method definition to accept more optional params
This commit is contained in:
parent
afed414030
commit
db7af88b87
@ -6,6 +6,11 @@ import { AutoUnsubscribe, IqserEventTarget } from '../utils';
|
|||||||
import { ConfirmOptions } from '../misc';
|
import { ConfirmOptions } from '../misc';
|
||||||
import { ConfirmationDialogService } from './confirmation-dialog.service';
|
import { ConfirmationDialogService } from './confirmation-dialog.service';
|
||||||
|
|
||||||
|
export interface SaveOptions {
|
||||||
|
closeAfterSave?: boolean;
|
||||||
|
addMembers?: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
@Directive()
|
@Directive()
|
||||||
/**
|
/**
|
||||||
* Extend this component when you want to submit the form after pressing enter.
|
* 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();
|
super();
|
||||||
}
|
}
|
||||||
|
|
||||||
abstract save(closeAfterSave?: boolean): void;
|
abstract save(options?: SaveOptions): void;
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.addSubscription = this._dialogRef.backdropClick().subscribe(() => {
|
this.addSubscription = this._dialogRef.backdropClick().subscribe(() => {
|
||||||
@ -78,7 +83,7 @@ export abstract class BaseDialogComponent extends AutoUnsubscribe implements OnI
|
|||||||
this._openConfirmDialog().then(result => {
|
this._openConfirmDialog().then(result => {
|
||||||
if (result in ConfirmOptions) {
|
if (result in ConfirmOptions) {
|
||||||
if (result === ConfirmOptions.CONFIRM) {
|
if (result === ConfirmOptions.CONFIRM) {
|
||||||
this.save(true);
|
this.save({ closeAfterSave: true });
|
||||||
} else {
|
} else {
|
||||||
this._dialogRef.close();
|
this._dialogRef.close();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user