diff --git a/npm/ng-packs/packages/core/src/lib/core.module.ts b/npm/ng-packs/packages/core/src/lib/core.module.ts index 79ecf7f1f8..4b657fe8bb 100644 --- a/npm/ng-packs/packages/core/src/lib/core.module.ts +++ b/npm/ng-packs/packages/core/src/lib/core.module.ts @@ -20,8 +20,8 @@ import { SessionState } from './states/session.state'; import { getInitialData } from './utils/initial-utils'; import { EllipsisDirective } from './directives/ellipsis.directive'; import { AutofocusDirective } from './directives/autofocus.directive'; -import { DebounceDirective } from './directives/debounce.directive'; -import { StopPropagationDirective } from './directives/stop-propagation.directive'; +import { InputEventDebounceDirective } from './directives/debounce.directive'; +import { ClickEventStopPropagationDirective } from './directives/stop-propagation.directive'; @NgModule({ imports: [ @@ -42,8 +42,8 @@ import { StopPropagationDirective } from './directives/stop-propagation.directiv LocalizationPipe, PermissionDirective, VisibilityDirective, - DebounceDirective, - StopPropagationDirective, + InputEventDebounceDirective, + ClickEventStopPropagationDirective, ], exports: [ CommonModule, @@ -58,9 +58,9 @@ import { StopPropagationDirective } from './directives/stop-propagation.directiv LocalizationPipe, PermissionDirective, VisibilityDirective, - DebounceDirective, + InputEventDebounceDirective, LocalizationPipe, - StopPropagationDirective, + ClickEventStopPropagationDirective, ], providers: [LocalizationPipe], entryComponents: [RouterOutletComponent, DynamicLayoutComponent], diff --git a/npm/ng-packs/packages/core/src/lib/directives/debounce.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/debounce.directive.ts index 55e8c23c92..144c43d4e2 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/debounce.directive.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/debounce.directive.ts @@ -6,7 +6,7 @@ import { takeUntilDestroy } from '@ngx-validate/core'; @Directive({ selector: '[input.debounce]', }) -export class DebounceDirective implements OnInit { +export class InputEventDebounceDirective implements OnInit { @Input() debounce: number = 300; @Output('input.debounce') debounceEvent = new EventEmitter(); diff --git a/npm/ng-packs/packages/core/src/lib/directives/stop-propagation.directive.ts b/npm/ng-packs/packages/core/src/lib/directives/stop-propagation.directive.ts index f2f6ac0384..ffa2e9e10b 100644 --- a/npm/ng-packs/packages/core/src/lib/directives/stop-propagation.directive.ts +++ b/npm/ng-packs/packages/core/src/lib/directives/stop-propagation.directive.ts @@ -1,18 +1,21 @@ import { Directive, ElementRef, EventEmitter, OnInit, Output, Renderer2 } from '@angular/core'; import { fromEvent } from 'rxjs'; +import { takeUntilDestroy } from '@ngx-validate/core'; @Directive({ selector: '[click.stop]', }) -export class StopPropagationDirective implements OnInit { +export class ClickEventStopPropagationDirective implements OnInit { @Output('click.stop') stopPropEvent = new EventEmitter(); constructor(private renderer: Renderer2, private el: ElementRef) {} ngOnInit(): void { - fromEvent(this.el.nativeElement, 'click').subscribe((event: MouseEvent) => { - event.stopPropagation(); - this.stopPropEvent.emit(event); - }); + fromEvent(this.el.nativeElement, 'click') + .pipe(takeUntilDestroy(this)) + .subscribe((event: MouseEvent) => { + event.stopPropagation(); + this.stopPropEvent.emit(event); + }); } }