Edit {{ appl
-
+
Create form<
-
+
diff --git a/projects/admin-core/src/lib/form/form-edit/form-edit.component.html b/projects/admin-core/src/lib/form/form-edit/form-edit.component.html
index 10f31e7ff..85c561d44 100644
--- a/projects/admin-core/src/lib/form/form-edit/form-edit.component.html
+++ b/projects/admin-core/src/lib/form/form-edit/form-edit.component.html
@@ -18,6 +18,6 @@ Edit {{ form.name }
-
+
}
diff --git a/projects/admin-core/src/lib/oidc/oidc-configuration-create/oidc-configuration-create.component.html b/projects/admin-core/src/lib/oidc/oidc-configuration-create/oidc-configuration-create.component.html
index 080b1148f..47f217b35 100644
--- a/projects/admin-core/src/lib/oidc/oidc-configuration-create/oidc-configuration-create.component.html
+++ b/projects/admin-core/src/lib/oidc/oidc-configuration-create/oidc-configuration-create.component.html
@@ -4,5 +4,5 @@ Cre
-
+
diff --git a/projects/admin-core/src/lib/oidc/oidc-configuration-edit/oidc-configuration-edit.component.html b/projects/admin-core/src/lib/oidc/oidc-configuration-edit/oidc-configuration-edit.component.html
index b686fa876..84bc6a004 100644
--- a/projects/admin-core/src/lib/oidc/oidc-configuration-edit/oidc-configuration-edit.component.html
+++ b/projects/admin-core/src/lib/oidc/oidc-configuration-edit/oidc-configuration-edit.component.html
@@ -35,6 +35,6 @@ OIDC roles mapped to groups
-
+
}
diff --git a/projects/admin-core/src/lib/search-index/search-index-edit/search-index-edit.component.html b/projects/admin-core/src/lib/search-index/search-index-edit/search-index-edit.component.html
index 6b5102394..6706f2236 100644
--- a/projects/admin-core/src/lib/search-index/search-index-edit/search-index-edit.component.html
+++ b/projects/admin-core/src/lib/search-index/search-index-edit/search-index-edit.component.html
@@ -41,6 +41,7 @@ Delete
Add group
-
+
diff --git a/projects/admin-core/src/lib/user/group-edit/group-edit.component.html b/projects/admin-core/src/lib/user/group-edit/group-edit.component.html
index 34abb0f62..080f7a08c 100644
--- a/projects/admin-core/src/lib/user/group-edit/group-edit.component.html
+++ b/projects/admin-core/src/lib/user/group-edit/group-edit.component.html
@@ -6,6 +6,6 @@ Edit {{ gro
-
+
}
diff --git a/projects/admin-core/src/lib/user/user-create/user-create.component.html b/projects/admin-core/src/lib/user/user-create/user-create.component.html
index f0097d342..b8d86d91b 100644
--- a/projects/admin-core/src/lib/user/user-create/user-create.component.html
+++ b/projects/admin-core/src/lib/user/user-create/user-create.component.html
@@ -4,5 +4,5 @@ Add user
-
+
diff --git a/projects/admin-core/src/lib/user/user-edit/user-edit.component.html b/projects/admin-core/src/lib/user/user-edit/user-edit.component.html
index 72cc254b0..47724627b 100644
--- a/projects/admin-core/src/lib/user/user-edit/user-edit.component.html
+++ b/projects/admin-core/src/lib/user/user-edit/user-edit.component.html
@@ -6,6 +6,11 @@ Edit {{ user.
-
+
}
diff --git a/projects/shared/src/lib/components/color-picker/color-picker.component.ts b/projects/shared/src/lib/components/color-picker/color-picker.component.ts
index 20026846c..27bde70d5 100644
--- a/projects/shared/src/lib/components/color-picker/color-picker.component.ts
+++ b/projects/shared/src/lib/components/color-picker/color-picker.component.ts
@@ -1,4 +1,6 @@
-import { Component, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Optional, Output, TemplateRef, ViewChild, inject } from '@angular/core';
+import {
+ Component, ElementRef, EventEmitter, Input, OnDestroy, OnInit, Optional, Output, TemplateRef, ViewChild, inject, HostListener,
+} from '@angular/core';
import { FormControl, ValidatorFn, Validators } from '@angular/forms';
import { debounceTime, filter } from 'rxjs/operators';
import { Subscription } from 'rxjs';
@@ -92,6 +94,14 @@ export class ColorPickerComponent implements OnInit, OnDestroy {
@Input()
public dropdownPosition: PopoverPositionEnum | undefined;
+ @HostListener('document:keydown.escape', ['$event'])
+ public onEscapeOnOverlay(e: KeyboardEvent) {
+ if (this.popoverRef?.isOpen) {
+ this.popoverRef?.close();
+ e.stopImmediatePropagation();
+ }
+ }
+
public pickerOpen = false;
public sortedColors: Array = [];
diff --git a/projects/shared/src/lib/directives/cancel-close-button.directive.ts b/projects/shared/src/lib/directives/cancel-close-button.directive.ts
new file mode 100644
index 000000000..07f2dd001
--- /dev/null
+++ b/projects/shared/src/lib/directives/cancel-close-button.directive.ts
@@ -0,0 +1,51 @@
+import { Directive, HostListener, Output, EventEmitter, inject, OnInit, OnDestroy } from '@angular/core';
+import { Router, RouterLink } from '@angular/router';
+import { MatDialog } from '@angular/material/dialog';
+import { CancelCloseButtonService } from '../services/cancel-close-button-service';
+
+@Directive({
+ selector: '[tmCancelCloseButton]',
+ standalone: false,
+})
+export class CancelCloseButtonDirective implements OnInit, OnDestroy {
+ private routerLink = inject(RouterLink, { optional: true });
+ private matDialog = inject(MatDialog);
+ private router = inject(Router);
+ private cancelCloseButtonService = inject(CancelCloseButtonService);
+
+ private handler = () => this.triggerAction();
+
+ @Output()
+ public cancelClose = new EventEmitter();
+
+ @HostListener('click')
+ public onClick() {
+ this.triggerAction();
+ }
+
+ @HostListener('window:keydown.escape', ['$event'])
+ public onEscape(event: KeyboardEvent) {
+ event.preventDefault();
+ event.stopPropagation();
+ event.stopImmediatePropagation();
+ if (this.matDialog.openDialogs.length === 0) {
+ this.cancelCloseButtonService.triggerTop();
+ }
+ }
+
+ private triggerAction() {
+ if (this.routerLink?.urlTree) {
+ this.router.navigateByUrl(this.routerLink.urlTree);
+ }
+ this.cancelClose.emit();
+ }
+
+ public ngOnInit(): void {
+ this.cancelCloseButtonService.push(this.handler);
+ }
+
+ public ngOnDestroy(): void {
+ this.cancelCloseButtonService.remove(this.handler);
+ }
+
+}
diff --git a/projects/shared/src/lib/directives/index.ts b/projects/shared/src/lib/directives/index.ts
index fe174e1fe..61e69afa2 100644
--- a/projects/shared/src/lib/directives/index.ts
+++ b/projects/shared/src/lib/directives/index.ts
@@ -1,3 +1,4 @@
export * from './auto-focus.directive';
export * from './tooltip.directive';
+export * from './cancel-close-button.directive';
export * from './shared-directives.module';
diff --git a/projects/shared/src/lib/directives/shared-directives.module.ts b/projects/shared/src/lib/directives/shared-directives.module.ts
index a8a95dc73..cc466cef1 100644
--- a/projects/shared/src/lib/directives/shared-directives.module.ts
+++ b/projects/shared/src/lib/directives/shared-directives.module.ts
@@ -1,16 +1,19 @@
import { NgModule } from '@angular/core';
import { TooltipDirective } from './tooltip.directive';
import { AutoFocusDirective } from './auto-focus.directive';
+import { CancelCloseButtonDirective } from './cancel-close-button.directive';
@NgModule({
declarations: [
AutoFocusDirective,
TooltipDirective,
+ CancelCloseButtonDirective,
],
exports: [
AutoFocusDirective,
TooltipDirective,
+ CancelCloseButtonDirective,
],
})
export class SharedDirectivesModule {
diff --git a/projects/shared/src/lib/services/cancel-close-button-service.ts b/projects/shared/src/lib/services/cancel-close-button-service.ts
new file mode 100644
index 000000000..bc8828a6d
--- /dev/null
+++ b/projects/shared/src/lib/services/cancel-close-button-service.ts
@@ -0,0 +1,23 @@
+import { Injectable } from '@angular/core';
+
+@Injectable({
+ providedIn: 'root',
+})
+export class CancelCloseButtonService {
+ private stack: (() => void)[] = [];
+
+ public push(handler: () => void) {
+ this.stack.push(handler);
+ }
+
+ public remove(handler: () => void) {
+ this.stack = this.stack.filter(h => h !== handler);
+ }
+
+ public triggerTop() {
+ const top = this.stack[this.stack.length - 1];
+ if (top) {
+ top();
+ }
+ }
+}