@igo2/common
Version:
62 lines (57 loc) • 2.69 kB
JavaScript
import * as i0 from '@angular/core';
import { EventEmitter, HostListener, Output, Directive, NgModule } from '@angular/core';
class ClickoutDirective {
el;
clickout = new EventEmitter();
handleMouseClick(event, target) {
if (!target) {
return;
}
if (!this.el.nativeElement.contains(target)) {
this.clickout.emit(event);
}
}
constructor(el) {
this.el = el;
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ClickoutDirective, deps: [{ token: i0.ElementRef }], target: i0.ɵɵFactoryTarget.Directive });
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.15", type: ClickoutDirective, isStandalone: true, selector: "[igoClickout]", outputs: { clickout: "clickout" }, host: { listeners: { "document:click": "handleMouseClick($event,$event.target)" } }, ngImport: i0 });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: ClickoutDirective, decorators: [{
type: Directive,
args: [{
selector: '[igoClickout]',
standalone: true
}]
}], ctorParameters: () => [{ type: i0.ElementRef }], propDecorators: { clickout: [{
type: Output
}], handleMouseClick: [{
type: HostListener,
args: ['document:click', ['$event', '$event.target']]
}] } });
/**
* @deprecated import the ClickoutDirective directly
*/
class IgoClickoutModule {
static forRoot() {
return {
ngModule: IgoClickoutModule,
providers: []
};
}
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: IgoClickoutModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.2.15", ngImport: i0, type: IgoClickoutModule, imports: [ClickoutDirective], exports: [ClickoutDirective] });
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: IgoClickoutModule });
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.15", ngImport: i0, type: IgoClickoutModule, decorators: [{
type: NgModule,
args: [{
imports: [ClickoutDirective],
exports: [ClickoutDirective]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { ClickoutDirective, IgoClickoutModule };
//# sourceMappingURL=igo2-common-clickout.mjs.map