@libs-ui/components-click-outside 0.2.343-0 → 0.2.344-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import { AfterViewInit
|
|
1
|
+
import { AfterViewInit } from '@angular/core';
|
|
2
2
|
import * as i0 from "@angular/core";
|
|
3
|
-
export declare class LibsUiComponentsClickOutsideDirective implements AfterViewInit
|
|
4
|
-
private onDestroy;
|
|
3
|
+
export declare class LibsUiComponentsClickOutsideDirective implements AfterViewInit {
|
|
5
4
|
readonly outOutside: import("@angular/core").OutputEmitterRef<Event>;
|
|
6
5
|
readonly outInSide: import("@angular/core").OutputEmitterRef<Event>;
|
|
7
6
|
private elementRef;
|
|
7
|
+
private destroyRef;
|
|
8
8
|
ngAfterViewInit(): void;
|
|
9
|
-
ngOnDestroy(): void;
|
|
10
9
|
static ɵfac: i0.ɵɵFactoryDeclaration<LibsUiComponentsClickOutsideDirective, never>;
|
|
11
10
|
static ɵdir: i0.ɵɵDirectiveDeclaration<LibsUiComponentsClickOutsideDirective, "[LibsUiComponentsClickOutsideDirective]", never, {}, { "outOutside": "outOutside"; "outInSide": "outInSide"; }, never, never, true, never>;
|
|
12
11
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { Directive, ElementRef, inject, output } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { DestroyRef, Directive, ElementRef, inject, output } from '@angular/core';
|
|
2
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
3
|
+
import { fromEvent } from 'rxjs';
|
|
4
|
+
import { tap } from 'rxjs/operators';
|
|
4
5
|
import * as i0 from "@angular/core";
|
|
5
6
|
export class LibsUiComponentsClickOutsideDirective {
|
|
6
|
-
onDestroy = new Subject();
|
|
7
7
|
outOutside = output();
|
|
8
8
|
outInSide = output();
|
|
9
9
|
elementRef = inject(ElementRef);
|
|
10
|
+
destroyRef = inject(DestroyRef);
|
|
10
11
|
ngAfterViewInit() {
|
|
11
12
|
fromEvent(window, 'mousedown')
|
|
12
|
-
.pipe(tap((e) => e.stopPropagation()),
|
|
13
|
+
.pipe(tap((e) => e.stopPropagation()), takeUntilDestroyed(this.destroyRef))
|
|
13
14
|
.subscribe((e) => {
|
|
14
15
|
const clickedInside = this.elementRef.nativeElement.contains(e.target);
|
|
15
16
|
if (clickedInside) {
|
|
@@ -19,10 +20,6 @@ export class LibsUiComponentsClickOutsideDirective {
|
|
|
19
20
|
this.outOutside.emit(e);
|
|
20
21
|
});
|
|
21
22
|
}
|
|
22
|
-
ngOnDestroy() {
|
|
23
|
-
this.onDestroy.next();
|
|
24
|
-
this.onDestroy.complete();
|
|
25
|
-
}
|
|
26
23
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsClickOutsideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
27
24
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: LibsUiComponentsClickOutsideDirective, isStandalone: true, selector: "[LibsUiComponentsClickOutsideDirective]", outputs: { outOutside: "outOutside", outInSide: "outInSide" }, ngImport: i0 });
|
|
28
25
|
}
|
|
@@ -34,4 +31,4 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
|
|
|
34
31
|
standalone: true,
|
|
35
32
|
}]
|
|
36
33
|
}] });
|
|
37
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
34
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpY2stb3V0c2lkZS5kaXJlY3RpdmUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi9saWJzLXVpL2NvbXBvbmVudHMvY2xpY2stb3V0c2lkZS9zcmMvY2xpY2stb3V0c2lkZS5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2lkZSA9IG91dHB1dDxFdmVudD4oKTtcblxuICBwcml2YXRlIGVsZW1lbnRSZWYgPSBpbmplY3QoRWxlbWVudFJlZik7XG4gIHByaXZhdGUgZGVzdHJveVJlZiA9IGluamVjdChEZXN0cm95UmVmKTtcbiAgbmdBZnRlclZpZXdJbml0KCkge1xuICAgIGZyb21FdmVudDxFdmVudD4od2luZG93LCAnbW91c2Vkb3duJylcbiAgICAgIC5waXBlKFxuICAgICAgICB0YXAoKGU6IEV2ZW50KSA9PiBlLnN0b3BQcm9wYWdhdGlvbigpKSxcbiAgICAgICAgdGFrZVVudGlsRGVzdHJveWVkKHRoaXMuZGVzdHJveVJlZilcbiAgICAgIClcbiAgICAgIC5zdWJzY3JpYmUoKGU6IEV2ZW50KSA9PiB7XG4gICAgICAgIGNvbnN0IGNsaWNrZWRJbnNpZGUgPSB0aGlzLmVsZW1lbnRSZWYubmF0aXZlRWxlbWVudC5jb250YWlucyhlLnRhcmdldCk7XG5cbiAgICAgICAgaWYgKGNsaWNrZWRJbnNpZGUpIHtcbiAgICAgICAgICB0aGlzLm91dEluU2lkZS5lbWl0KGUpO1xuXG4gICAgICAgICAgcmV0dXJuO1xuICAgICAgICB9XG4gICAgICAgIHRoaXMub3V0T3V0c2lkZS5lbWl0KGUpO1xuICAgICAgfSk7XG4gIH1cbn1cbiJdfQ==
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { output, inject, ElementRef, Directive } from '@angular/core';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { output, inject, ElementRef, DestroyRef, Directive } from '@angular/core';
|
|
3
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
4
|
+
import { fromEvent } from 'rxjs';
|
|
5
|
+
import { tap } from 'rxjs/operators';
|
|
5
6
|
|
|
6
7
|
class LibsUiComponentsClickOutsideDirective {
|
|
7
|
-
onDestroy = new Subject();
|
|
8
8
|
outOutside = output();
|
|
9
9
|
outInSide = output();
|
|
10
10
|
elementRef = inject(ElementRef);
|
|
11
|
+
destroyRef = inject(DestroyRef);
|
|
11
12
|
ngAfterViewInit() {
|
|
12
13
|
fromEvent(window, 'mousedown')
|
|
13
|
-
.pipe(tap((e) => e.stopPropagation()),
|
|
14
|
+
.pipe(tap((e) => e.stopPropagation()), takeUntilDestroyed(this.destroyRef))
|
|
14
15
|
.subscribe((e) => {
|
|
15
16
|
const clickedInside = this.elementRef.nativeElement.contains(e.target);
|
|
16
17
|
if (clickedInside) {
|
|
@@ -20,10 +21,6 @@ class LibsUiComponentsClickOutsideDirective {
|
|
|
20
21
|
this.outOutside.emit(e);
|
|
21
22
|
});
|
|
22
23
|
}
|
|
23
|
-
ngOnDestroy() {
|
|
24
|
-
this.onDestroy.next();
|
|
25
|
-
this.onDestroy.complete();
|
|
26
|
-
}
|
|
27
24
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.14", ngImport: i0, type: LibsUiComponentsClickOutsideDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
28
25
|
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.14", type: LibsUiComponentsClickOutsideDirective, isStandalone: true, selector: "[LibsUiComponentsClickOutsideDirective]", outputs: { outOutside: "outOutside", outInSide: "outInSide" }, ngImport: i0 });
|
|
29
26
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libs-ui-components-click-outside.mjs","sources":["../../../../../libs-ui/components/click-outside/src/click-outside.directive.ts","../../../../../libs-ui/components/click-outside/src/libs-ui-components-click-outside.ts"],"sourcesContent":["import { AfterViewInit, Directive, ElementRef, inject,
|
|
1
|
+
{"version":3,"file":"libs-ui-components-click-outside.mjs","sources":["../../../../../libs-ui/components/click-outside/src/click-outside.directive.ts","../../../../../libs-ui/components/click-outside/src/libs-ui-components-click-outside.ts"],"sourcesContent":["import { AfterViewInit, DestroyRef, Directive, ElementRef, inject, output } from '@angular/core';\nimport { takeUntilDestroyed } from '@angular/core/rxjs-interop';\nimport { fromEvent } from 'rxjs';\nimport { tap } from 'rxjs/operators';\n\n@Directive({\n // eslint-disable-next-line @angular-eslint/directive-selector\n selector: '[LibsUiComponentsClickOutsideDirective]',\n standalone: true,\n})\nexport class LibsUiComponentsClickOutsideDirective implements AfterViewInit {\n readonly outOutside = output<Event>();\n readonly outInSide = output<Event>();\n\n private elementRef = inject(ElementRef);\n private destroyRef = inject(DestroyRef);\n ngAfterViewInit() {\n fromEvent<Event>(window, 'mousedown')\n .pipe(\n tap((e: Event) => e.stopPropagation()),\n takeUntilDestroyed(this.destroyRef)\n )\n .subscribe((e: Event) => {\n const clickedInside = this.elementRef.nativeElement.contains(e.target);\n\n if (clickedInside) {\n this.outInSide.emit(e);\n\n return;\n }\n this.outOutside.emit(e);\n });\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;;;MAUa,qCAAqC,CAAA;IACvC,UAAU,GAAG,MAAM,EAAS;IAC5B,SAAS,GAAG,MAAM,EAAS;AAE5B,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;AAC/B,IAAA,UAAU,GAAG,MAAM,CAAC,UAAU,CAAC;IACvC,eAAe,GAAA;AACb,QAAA,SAAS,CAAQ,MAAM,EAAE,WAAW;aACjC,IAAI,CACH,GAAG,CAAC,CAAC,CAAQ,KAAK,CAAC,CAAC,eAAe,EAAE,CAAC,EACtC,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC;AAEpC,aAAA,SAAS,CAAC,CAAC,CAAQ,KAAI;AACtB,YAAA,MAAM,aAAa,GAAG,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;YAEtE,IAAI,aAAa,EAAE;AACjB,gBAAA,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;gBAEtB;YACF;AACA,YAAA,IAAI,C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