From 9a79f37bf143a1e05df7407358e2687c678e3e68 Mon Sep 17 00:00:00 2001 From: Mihajlo Medjedovic Date: Thu, 30 May 2024 09:47:08 +0200 Subject: [PATCH] fix: added stealFocus directive --- client/src/app/directives/directives.module.ts | 7 +++++-- .../app/directives/steal-focus.directive.ts | 18 ++++++++++++++++++ client/src/app/group/group.component.html | 2 +- client/src/app/group/group.component.ts | 9 --------- client/src/app/home/home.component.html | 4 ++-- client/src/app/home/home.component.ts | 9 --------- client/src/app/lineage/lineage.component.html | 6 +++--- client/src/app/lineage/lineage.component.ts | 9 --------- .../src/app/metadata/metadata.component.html | 2 +- client/src/app/metadata/metadata.component.ts | 9 --------- client/src/app/role/role.component.html | 2 +- client/src/app/role/role.component.ts | 9 --------- .../app/shared/dc-tree/dc-tree.component.html | 6 +++--- .../app/shared/dc-tree/dc-tree.component.ts | 9 --------- client/src/app/user/user.component.html | 2 +- client/src/app/user/user.component.ts | 9 --------- client/src/app/viewer/viewer.component.html | 4 ++-- client/src/app/viewer/viewer.component.ts | 9 --------- .../viya-api-explorer.component.html | 2 +- .../viya-api-explorer.component.ts | 9 --------- client/src/app/xlmap/xlmap.component.html | 2 +- client/src/app/xlmap/xlmap.component.ts | 9 --------- 22 files changed, 39 insertions(+), 108 deletions(-) create mode 100644 client/src/app/directives/steal-focus.directive.ts diff --git a/client/src/app/directives/directives.module.ts b/client/src/app/directives/directives.module.ts index c919ee0..404e2b4 100644 --- a/client/src/app/directives/directives.module.ts +++ b/client/src/app/directives/directives.module.ts @@ -4,20 +4,23 @@ import { NgVarDirective } from './ng-var.directive' import { DragNdropDirective } from './drag-ndrop.directive' import { FileDropDirective } from './file-drop.directive' import { FileSelectDirective } from './file-select.directive' +import { StealFocusDirective } from './steal-focus.directive' @NgModule({ declarations: [ NgVarDirective, DragNdropDirective, FileDropDirective, - FileSelectDirective + FileSelectDirective, + StealFocusDirective ], imports: [CommonModule], exports: [ NgVarDirective, DragNdropDirective, FileDropDirective, - FileSelectDirective + FileSelectDirective, + StealFocusDirective ] }) export class DirectivesModule {} diff --git a/client/src/app/directives/steal-focus.directive.ts b/client/src/app/directives/steal-focus.directive.ts new file mode 100644 index 0000000..d806090 --- /dev/null +++ b/client/src/app/directives/steal-focus.directive.ts @@ -0,0 +1,18 @@ +import { Directive, HostListener } from '@angular/core'; + +@Directive({ + selector: '[appStealFocus]' +}) +export class StealFocusDirective { + + constructor() { } + + /** + * For some reason newest version of Clarity v17.0.1 is stealing focus when + * clicking on the input inside of the clr-tree-view + * This is workaround + */ + @HostListener('click', ['$event']) onClick(event: any){ + event.target.focus() + } +} diff --git a/client/src/app/group/group.component.html b/client/src/app/group/group.component.html index 509113d..653127f 100644 --- a/client/src/app/group/group.component.html +++ b/client/src/app/group/group.component.html @@ -3,7 +3,7 @@
{ if (library.LIBRARYID !== libraryToSkip.LIBRARYID) { diff --git a/client/src/app/lineage/lineage.component.html b/client/src/app/lineage/lineage.component.html index 97efde2..f9c4b4b 100644 --- a/client/src/app/lineage/lineage.component.html +++ b/client/src/app/lineage/lineage.component.html @@ -3,7 +3,7 @@