UNPKG

novo-elements

Version:

Bullhorn's NOVO Element Repository for Angular 2

48 lines 1.71 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ALWAYS = 'always'; exports.DISABLED = 'disabled'; exports.OUTSIDE_CLICK = 'outsideClick'; exports.POSITION_LEFT = 'left'; exports.POSITION_RIGHT = 'right'; exports.POSITION_TOP = 'top'; exports.POSITION_BOTTOM = 'bottom'; var DrawerService = (function () { function DrawerService() { this.closeDrawerBind = this.closeDrawer.bind(this); } DrawerService.prototype.open = function (scope) { if (!this.openScope) { window.document.addEventListener('click', this.closeDrawerBind); } if (this.openScope && this.openScope !== this.scope) { this.openScope.isOpen = false; } this.openScope = scope; }; DrawerService.prototype.close = function (scope) { if (this.openScope !== scope) { return; } this.openScope = null; window.document.removeEventListener('click', this.closeDrawerBind); }; DrawerService.prototype.closeDrawer = function (event) { if (!this.openScope) { return; } if (event && this.openScope.autoClose === exports.DISABLED) { return; } if (event && this.openScope.toggleEl && this.openScope.toggleEl.nativeElement === event.target) { return; } if (event && this.openScope.autoClose === exports.OUTSIDE_CLICK && this.openScope.drawerEl && this.openScope.drawerEl.nativeElement === event.target) { return; } this.openScope.isOpen = false; }; return DrawerService; }()); exports.DrawerService = DrawerService; //# sourceMappingURL=DrawerService.js.map