ng-cw-v12
Version:
Angular UI component library
89 lines (80 loc) • 4.68 kB
JavaScript
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core')) :
typeof define === 'function' && define.amd ? define('ng-cw-v12/click-outside', ['exports', '@angular/core'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global["ng-cw-v12"] = global["ng-cw-v12"] || {}, global["ng-cw-v12"]["click-outside"] = {}), global.ng.core));
})(this, (function (exports, i0) { 'use strict';
function _interopNamespace(e) {
if (e && e.__esModule) return e;
var n = Object.create(null);
if (e) {
Object.keys(e).forEach(function (k) {
if (k !== 'default') {
var d = Object.getOwnPropertyDescriptor(e, k);
Object.defineProperty(n, k, d.get ? d : {
enumerable: true,
get: function () { return e[k]; }
});
}
});
}
n["default"] = e;
return Object.freeze(n);
}
var i0__namespace = /*#__PURE__*/_interopNamespace(i0);
var ClickOutsideDirective = /** @class */ (function () {
function ClickOutsideDirective(_elementRef) {
this._elementRef = _elementRef;
this.ncClickOut = new i0.EventEmitter();
}
ClickOutsideDirective.prototype.onClick = function (event, targetElement) {
if (!targetElement) {
return;
}
var clickedInside = this._elementRef.nativeElement.contains(targetElement);
if (!clickedInside) {
this.ncClickOut.emit(event);
}
};
return ClickOutsideDirective;
}());
ClickOutsideDirective.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: ClickOutsideDirective, deps: [{ token: i0__namespace.ElementRef }], target: i0__namespace.ɵɵFactoryTarget.Directive });
ClickOutsideDirective.ɵdir = i0__namespace.ɵɵngDeclareDirective({ minVersion: "12.0.0", version: "12.1.5", type: ClickOutsideDirective, selector: "[ncClickOutside]", outputs: { ncClickOut: "ncClickOut" }, host: { listeners: { "document:click": "onClick($event,$event.target)" } }, ngImport: i0__namespace });
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: ClickOutsideDirective, decorators: [{
type: i0.Directive,
args: [{
selector: '[ncClickOutside]'
}]
}], ctorParameters: function () { return [{ type: i0__namespace.ElementRef }]; }, propDecorators: { ncClickOut: [{
type: i0.Output
}], onClick: [{
type: i0.HostListener,
args: ['document:click', ['$event', '$event.target']]
}] } });
var NcClickOutsideModule = /** @class */ (function () {
function NcClickOutsideModule() {
}
return NcClickOutsideModule;
}());
NcClickOutsideModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NcClickOutsideModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
NcClickOutsideModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NcClickOutsideModule, declarations: [ClickOutsideDirective], exports: [ClickOutsideDirective] });
NcClickOutsideModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NcClickOutsideModule, imports: [[]] });
i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.1.5", ngImport: i0__namespace, type: NcClickOutsideModule, decorators: [{
type: i0.NgModule,
args: [{
declarations: [
ClickOutsideDirective
],
imports: [],
exports: [
ClickOutsideDirective
]
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
exports.ClickOutsideDirective = ClickOutsideDirective;
exports.NcClickOutsideModule = NcClickOutsideModule;
Object.defineProperty(exports, '__esModule', { value: true });
}));
//# sourceMappingURL=ng-cw-v12-click-outside.umd.js.map