diff --git a/src/lib/buttons/circle-button/circle-button.component.html b/src/lib/buttons/circle-button/circle-button.component.html
index ad891b4..bc494e3 100644
--- a/src/lib/buttons/circle-button/circle-button.component.html
+++ b/src/lib/buttons/circle-button/circle-button.component.html
@@ -9,9 +9,9 @@
[class.warn]="type === circleButtonTypes.warn"
[disabled]="disabled"
[id]="buttonId"
+ [stopPropagation]="action.observed"
[type]="isSubmit ? 'submit' : 'button'"
mat-icon-button
- stopPropagation
>
diff --git a/src/lib/buttons/icon-button/icon-button.component.html b/src/lib/buttons/icon-button/icon-button.component.html
index 0ff933a..338e226 100644
--- a/src/lib/buttons/icon-button/icon-button.component.html
+++ b/src/lib/buttons/icon-button/icon-button.component.html
@@ -3,9 +3,9 @@
[disabled]="disabled"
[id]="buttonId"
[ngClass]="classes"
+ [stopPropagation]="action.observed"
[type]="submit ? 'submit' : 'button'"
mat-button
- stopPropagation
>
{{ label }}
diff --git a/src/lib/dialog/base-dialog.component.ts b/src/lib/dialog/base-dialog.component.ts
index a5bb814..00d88b6 100644
--- a/src/lib/dialog/base-dialog.component.ts
+++ b/src/lib/dialog/base-dialog.component.ts
@@ -30,7 +30,7 @@ export abstract class BaseDialogComponent implements OnInit, OnDestroy {
readonly #subscriptions: Subscription = new Subscription();
#hasErrors = false;
- protected constructor(protected readonly _dialogRef: MatDialogRef, private readonly _isInEditMode?: boolean) {}
+ protected constructor(protected readonly _dialogRef: MatDialogRef, private readonly _isInEditMode = false) {}
get valid(): boolean {
return !this.form || this.form.valid;
@@ -63,7 +63,7 @@ export abstract class BaseDialogComponent implements OnInit, OnDestroy {
close() {
if (!this._isInEditMode || !this.changed) {
- this._dialogRef.close();
+ return this._dialogRef.close();
}
this._openConfirmDialog().then(result => {
diff --git a/src/lib/directives/prevent-default.directive.ts b/src/lib/directives/prevent-default.directive.ts
index f9e34ec..9ca2018 100644
--- a/src/lib/directives/prevent-default.directive.ts
+++ b/src/lib/directives/prevent-default.directive.ts
@@ -1,12 +1,17 @@
-import { Directive, HostListener } from '@angular/core';
+import { Directive, HostListener, Input } from '@angular/core';
@Directive({
selector: '[preventDefault]',
standalone: true,
})
export class PreventDefaultDirective {
+ @Input() preventDefault: boolean | string = true;
+
@HostListener('click', ['$event'])
onClick($event: Event) {
- $event.preventDefault();
+ const stop = this.preventDefault === '' || this.preventDefault === 'true' || this.preventDefault === true;
+ if (stop) {
+ $event.preventDefault();
+ }
}
}
diff --git a/src/lib/directives/stop-propagation.directive.ts b/src/lib/directives/stop-propagation.directive.ts
index 85818ee..d7f98d7 100644
--- a/src/lib/directives/stop-propagation.directive.ts
+++ b/src/lib/directives/stop-propagation.directive.ts
@@ -1,12 +1,17 @@
-import { Directive, HostListener } from '@angular/core';
+import { Directive, HostListener, Input } from '@angular/core';
@Directive({
selector: '[stopPropagation]',
standalone: true,
})
export class StopPropagationDirective {
+ @Input() stopPropagation: boolean | string = true;
+
@HostListener('click', ['$event'])
onClick($event: Event) {
- $event.stopPropagation();
+ const stop = this.stopPropagation === '' || this.stopPropagation === 'true' || this.stopPropagation === true;
+ if (stop) {
+ $event.stopPropagation();
+ }
}
}
diff --git a/src/lib/empty-state/empty-state.component.ts b/src/lib/empty-state/empty-state.component.ts
index 0217eb0..622c31b 100644
--- a/src/lib/empty-state/empty-state.component.ts
+++ b/src/lib/empty-state/empty-state.component.ts
@@ -28,6 +28,6 @@ export class EmptyStateComponent implements OnInit {
@Output() readonly action = new EventEmitter();
ngOnInit(): void {
- this.showButton = this.showButton && this.action.observers.length > 0;
+ this.showButton = this.showButton && this.action.observed;
}
}