fix: added stealFocus directive

This commit is contained in:
Mihajlo Medjedovic 2024-05-30 09:47:08 +02:00
parent 85909cfc1e
commit 9a79f37bf1
22 changed files with 39 additions and 108 deletions

View File

@ -4,20 +4,23 @@ import { NgVarDirective } from './ng-var.directive'
import { DragNdropDirective } from './drag-ndrop.directive' import { DragNdropDirective } from './drag-ndrop.directive'
import { FileDropDirective } from './file-drop.directive' import { FileDropDirective } from './file-drop.directive'
import { FileSelectDirective } from './file-select.directive' import { FileSelectDirective } from './file-select.directive'
import { StealFocusDirective } from './steal-focus.directive'
@NgModule({ @NgModule({
declarations: [ declarations: [
NgVarDirective, NgVarDirective,
DragNdropDirective, DragNdropDirective,
FileDropDirective, FileDropDirective,
FileSelectDirective FileSelectDirective,
StealFocusDirective
], ],
imports: [CommonModule], imports: [CommonModule],
exports: [ exports: [
NgVarDirective, NgVarDirective,
DragNdropDirective, DragNdropDirective,
FileDropDirective, FileDropDirective,
FileSelectDirective FileSelectDirective,
StealFocusDirective
] ]
}) })
export class DirectivesModule {} export class DirectivesModule {}

View File

@ -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()
}
}

View File

@ -3,7 +3,7 @@
<clr-tree-node *ngIf="groups" class="search-node"> <clr-tree-node *ngIf="groups" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchLibTreeInput #searchLibTreeInput
placeholder="Filter by Groups" placeholder="Filter by Groups"

View File

@ -147,15 +147,6 @@ export class GroupComponent implements OnInit {
} }
} }
/**
* 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
*/
public stealFocusFix(event: any) {
event.target.focus()
}
public groupListOnFilter() { public groupListOnFilter() {
this.helperService.libraryOnFilter( this.helperService.libraryOnFilter(
this.groups, this.groups,

View File

@ -3,8 +3,8 @@
<clr-tree-node *ngIf="treeNodeLibraries?.length! > 0" class="search-node"> <clr-tree-node *ngIf="treeNodeLibraries?.length! > 0" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)"
clrInput clrInput
appStealFocus
#searchLibTreeInput #searchLibTreeInput
placeholder="Libraries" placeholder="Libraries"
name="input" name="input"
@ -47,7 +47,7 @@
<clr-tree-node *ngIf="library['tables']" class="search-node"> <clr-tree-node *ngIf="library['tables']" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchTreeInput #searchTreeInput
placeholder="Tables" placeholder="Tables"

View File

@ -45,15 +45,6 @@ export class HomeComponent implements AfterContentInit {
private sasService: SasService private sasService: SasService
) {} ) {}
/**
* 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
*/
public stealFocusFix(event: any) {
event.target.focus()
}
public collapseLibraryItems(libraries: any, libraryToSkip: any) { public collapseLibraryItems(libraries: any, libraryToSkip: any) {
libraries.forEach((library: any) => { libraries.forEach((library: any) => {
if (library.LIBRARYID !== libraryToSkip.LIBRARYID) { if (library.LIBRARYID !== libraryToSkip.LIBRARYID) {

View File

@ -3,7 +3,7 @@
<clr-tree-node *ngIf="libraryList" class="search-node"> <clr-tree-node *ngIf="libraryList" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchLibTreeInput #searchLibTreeInput
placeholder="Libraries" placeholder="Libraries"
@ -43,7 +43,7 @@
<clr-tree-node *ngIf="library['tables']" class="search-node"> <clr-tree-node *ngIf="library['tables']" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchTreeInput #searchTreeInput
placeholder="Tables" placeholder="Tables"
@ -87,7 +87,7 @@
<clr-tree-node *ngIf="libTable['columns']" class="search-node"> <clr-tree-node *ngIf="libTable['columns']" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchTreeInput #searchTreeInput
placeholder="Columns" placeholder="Columns"

View File

@ -71,15 +71,6 @@ export class LineageComponent {
public helperService: HelperService public helperService: HelperService
) {} ) {}
/**
* 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
*/
public stealFocusFix(event: any) {
event.target.focus()
}
public showTableSelect() { public showTableSelect() {
this.tableFlag = !this.tableFlag this.tableFlag = !this.tableFlag
} }

View File

@ -22,7 +22,7 @@
<clr-tree-node *ngIf="metaDataList" class="search-node"> <clr-tree-node *ngIf="metaDataList" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchLibTreeInput #searchLibTreeInput
placeholder="search SAS Types" placeholder="search SAS Types"

View File

@ -150,15 +150,6 @@ export class MetadataComponent implements OnInit {
} }
} }
/**
* 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
*/
public stealFocusFix(event: any) {
event.target.focus()
}
public treeNodeClicked(event: any, item: any, tree: any) { public treeNodeClicked(event: any, item: any, tree: any) {
if (event.target.title === 'Collapse') { if (event.target.title === 'Collapse') {
this.collapseTreeItems(tree, item) this.collapseTreeItems(tree, item)

View File

@ -3,7 +3,7 @@
<clr-tree-node *ngIf="roles" class="search-node"> <clr-tree-node *ngIf="roles" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchLibTreeInput #searchLibTreeInput
placeholder="Filter by Roles" placeholder="Filter by Roles"

View File

@ -106,15 +106,6 @@ export class RoleComponent implements OnInit {
} }
} }
/**
* 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
*/
public stealFocusFix(event: any) {
event.target.focus()
}
public roleListOnFilter() { public roleListOnFilter() {
this.helperService.libraryOnFilter(this.roles, this.roleSearch, 'ROLENAME') this.helperService.libraryOnFilter(this.roles, this.roleSearch, 'ROLENAME')
globals.usernav.roleSearch = this.roleSearch globals.usernav.roleSearch = this.roleSearch

View File

@ -2,7 +2,7 @@
<clr-tree-node *ngIf="libraryList" class="search-node"> <clr-tree-node *ngIf="libraryList" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchLibTreeInput #searchLibTreeInput
placeholder="Libraries" placeholder="Libraries"
@ -46,7 +46,7 @@
<clr-tree-node *ngIf="library['tables']" class="search-node"> <clr-tree-node *ngIf="library['tables']" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchTreeInput #searchTreeInput
placeholder="Tables" placeholder="Tables"
@ -116,7 +116,7 @@
<clr-tree-node *ngIf="libTable['columns']" class="search-node"> <clr-tree-node *ngIf="libTable['columns']" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchTreeInput #searchTreeInput
placeholder="Columns" placeholder="Columns"

View File

@ -66,15 +66,6 @@ export class DcTreeComponent implements OnInit, AfterViewInit, OnChanges {
} }
} }
/**
* 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
*/
public stealFocusFix(event: any) {
event.target.focus()
}
treeOnFilter(array: any, arrToFilter: string) { treeOnFilter(array: any, arrToFilter: string) {
this.helperService.treeOnFilter(array, arrToFilter) this.helperService.treeOnFilter(array, arrToFilter)
} }

View File

@ -3,7 +3,7 @@
<clr-tree-node *ngIf="users" class="search-node"> <clr-tree-node *ngIf="users" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchLibTreeInput #searchLibTreeInput
placeholder="Filter by Users" placeholder="Filter by Users"

View File

@ -184,15 +184,6 @@ export class UserComponent implements OnInit {
} }
} }
/**
* 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
*/
public stealFocusFix(event: any) {
event.target.focus()
}
public userListOnFilter() { public userListOnFilter() {
this.helperService.libraryOnFilter(this.users, this.userSearch, 'NAME') this.helperService.libraryOnFilter(this.users, this.userSearch, 'NAME')
globals.usernav.userSearch = this.userSearch globals.usernav.userSearch = this.userSearch

View File

@ -7,7 +7,7 @@
<clr-tree-node *ngIf="libraries" class="search-node"> <clr-tree-node *ngIf="libraries" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchLibTreeInput #searchLibTreeInput
[(ngModel)]="librariesSearch" [(ngModel)]="librariesSearch"
@ -51,7 +51,7 @@
<clr-tree-node *ngIf="library['tables']" class="search-node"> <clr-tree-node *ngIf="library['tables']" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchTreeInput #searchTreeInput
[id]="'search_' + library.LIBRARYREF" [id]="'search_' + library.LIBRARYREF"

View File

@ -215,15 +215,6 @@ export class ViewerComponent implements AfterContentInit, AfterViewInit {
) )
} }
/**
* 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
*/
public stealFocusFix(event: any) {
event.target.focus()
}
/** /**
* Open viewboxes modal * Open viewboxes modal
*/ */

View File

@ -38,7 +38,7 @@
<clr-tree-node *ngIf="endpointLinks.length > 0" class="search-node"> <clr-tree-node *ngIf="endpointLinks.length > 0" class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchLinksTreeInput #searchLinksTreeInput
placeholder="Search links" placeholder="Search links"

View File

@ -53,15 +53,6 @@ export class ViyaApiExplorerComponent implements OnInit {
this.collections = this.sasViyaService.getAllCollections() this.collections = this.sasViyaService.getAllCollections()
} }
/**
* 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
*/
public stealFocusFix(event: any) {
event.target.focus()
}
linksListOnFilter() { linksListOnFilter() {
this.helperService.libraryOnFilter( this.helperService.libraryOnFilter(
this.endpointLinks, this.endpointLinks,

View File

@ -7,7 +7,7 @@
<clr-tree-node class="search-node"> <clr-tree-node class="search-node">
<div class="tree-search-wrapper"> <div class="tree-search-wrapper">
<input <input
(click)="stealFocusFix($event)" appStealFocus
clrInput clrInput
#searchXLMapTreeInput #searchXLMapTreeInput
placeholder="Filter by Id" placeholder="Filter by Id"

View File

@ -143,15 +143,6 @@ export class XLMapComponent implements AfterContentInit, AfterViewInit, OnInit {
private sasService: SasService private sasService: SasService
) {} ) {}
/**
* 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
*/
public stealFocusFix(event: any) {
event.target.focus()
}
public afterGetColHeader(column: number, th: any) { public afterGetColHeader(column: number, th: any) {
// Dark mode // Dark mode
th.classList.add('darkTH') th.classList.add('darkTH')