{"version":3,"sources":["../../node_modules/tslib/tslib.es6.js","../../src/app/components/contextmenu/contextmenu.ts"],"names":["Object","create","__values","o","s","Symbol","iterator","m","i","call","length","next","value","done","TypeError","ContextMenuSub","contextMenu","this","leafClick","EventEmitter","prototype","ngOnInit","_this","activeItemKeyChangeSubscription","contextMenuService","activeItemKeyChange$","pipe","takeUntil","ngDestroy$","subscribe","activeItemKey","isActive","parentItemKey","DomHandler","hasClass","sublistViewChild","nativeElement","positionSubmenu","cd","markForCheck","onItemMouseEnter","event","item","key","hideTimeout","clearTimeout","disabled","items","childSublist","findSingle","currentTarget","addClass","changeKey","onItemMouseLeave","el","contains","toElement","removeActiveFromSubLists","root","onItemClick","menuitem","preventDefault","url","routerLink","command","originalEvent","onLeafClick","hide","emit","getKey","index","String","startsWith","Component","args","selector","template","encapsulation","ViewEncapsulation","None","Inject","forwardRef","ContextMenu","Input","Output","ViewChild","renderer","zone","autoZIndex","baseZIndex","triggerEvent","onShow","onHide","Subject","ngAfterViewInit","global","documentTarget","ownerDocument","triggerEventListener","listen","show","target","stopPropagation","appendTo","document","body","appendChild","containerViewChild","clearActiveItem","position","moveOnTop","style","display","fadeIn","bindGlobalListeners","unbindGlobalListeners","zIndex","zindex","toggle","offsetParent","left","pageX","top","pageY","width","offsetWidth","getHiddenElementOuterWidth","height","offsetHeight","getHiddenElementOuterHeight","viewport","getViewport","scrollLeft","scrollTop","sublist","parentMenuItem","parentElement","sublistWidth","sublistHeight","itemOuterWidth","getOuterWidth","children","itemOuterHeight","getOuterHeight","containerOffset","getOffset","parseInt","calculateScrollbarHeight","removeProperty","bottom","calculateScrollbarWidth","isItemMatched","findNextItem","isRepeated","nextMenuitem","nextElementSibling","firstItem","findPrevItem","prevMenuitem","previousElementSibling","lastItem","getActiveItem","reset","sublists","find","sublists_1","sublists_1_1","removeClass","removeActiveFromSublist","documentClickListener","isOutsideClicked","button","runOutsideAngular","windowResizeListener","onWindowResize","bind","window","addEventListener","documentKeydownListener","activeItem","getAttribute","handleItemClick","findModelItemFromKey","model","split","reduce","currentIndex","removeEventListener","isSameNode","ngOnDestroy","complete","changeDetection","ChangeDetectionStrategy","OnPush","ElementRef","Renderer2","ChangeDetectorRef","NgZone","ContextMenuService","NgModule","imports","CommonModule","RouterModule","RippleModule","exports","declarations","providers"],"mappings":";;;;;;;;;;;;;;oFAyG6BA,OAAOC,gBAYpBC,EAASC,GACrB,IAAIC,EAAsB,mBAAXC,QAAyBA,OAAOC,SAAUC,EAAIH,GAAKD,EAAEC,GAAII,EAAI,EAC5E,GAAID,EAAG,OAAOA,EAAEE,KAAKN,GACrB,GAAIA,GAAyB,iBAAbA,EAAEO,OAAqB,MAAO,CAC1CC,KAAM,WAEF,OADIR,GAAKK,GAAKL,EAAEO,SAAQP,OAAI,GACrB,CAAES,MAAOT,GAAKA,EAAEK,KAAMK,MAAOV,KAG5C,MAAM,IAAIW,UAAUV,EAAI,0BAA4B,mCAqE/BJ,OAAOC,wBCnI5B,SAAAc,EAAmDC,GAdzCC,KAAAC,UAA+B,IAAIC,EAAAA,aAezCF,KAAKD,YAAcA,SAGvBD,EAAAK,UAAAC,SAAA,WAAA,IAAAC,EAAAL,KACIA,KAAKM,gCAAkCN,KAAKD,YAAYQ,mBAAmBC,qBAAqBC,KAAKC,EAAAA,UAAUV,KAAKD,YAAYY,aAAaC,WAAU,SAACC,GACpJR,EAAKQ,cAAgBA,EAEjBR,EAAKS,SAAST,EAAKU,gBAAkBC,EAAAA,WAAWC,SAASZ,EAAKa,iBAAiBC,cAAe,0BAC9Fd,EAAKN,YAAYqB,gBAAgBf,EAAKa,iBAAiBC,eAG3Dd,EAAKN,YAAYsB,GAAGC,mBAI5BxB,EAAAK,UAAAoB,iBAAA,SAAiBC,EAAOC,EAAMC,GAM1B,GALI1B,KAAK2B,cACLC,aAAa5B,KAAK2B,aAClB3B,KAAK2B,YAAc,OAGnBF,EAAKI,SAAT,CAIA,GAAIJ,EAAKK,MAAO,CACZ,IAAIC,EAAef,EAAAA,WA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A,wBAEAA,EAAAA,0BAEAA,EAAAA,0BAEAA,EAAAA,4BAEAA,EAAAA,sBAEAC,EAAAA,uBAEAA,EAAAA,mCAEAC,EAAAA,UAASX,KAAA,CAAC,sBAoZf,iCANC6H,EAAAA,SAAQ7H,KAAA,CAAC,CACN8H,QAAS,CAACC,EAAAA,aAAaC,EAAAA,aAAaC,EAAAA,cACpCC,QAAS,CAAC1H,EAAYwH,EAAAA,cACtBG,aAAc,CAAC3H,EAAYnE,GAC3B+L,UAAW,CAACR,EAAAA","sourcesContent":["/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n};\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, privateMap) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to get private field on non-instance\");\r\n }\r\n return privateMap.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, privateMap, value) {\r\n if (!privateMap.has(receiver)) {\r\n throw new TypeError(\"attempted to set private field on non-instance\");\r\n }\r\n privateMap.set(receiver, value);\r\n return value;\r\n}\r\n","import { NgModule,Component,ElementRef,AfterViewInit,OnDestroy,Input,Output,Renderer2,Inject,forwardRef,ViewChild,NgZone,EventEmitter,ChangeDetectionStrategy, ViewEncapsulation, ChangeDetectorRef } from '@angular/core';\nimport { CommonModule } from '@angular/common';\nimport { DomHandler } from 'primeng/dom';\nimport { MenuItem, ContextMenuService } from 'primeng/api';\nimport { RippleModule } from 'primeng/ripple';\nimport { RouterModule } from '@angular/router';\nimport { Subject, Subscription } from 'rxjs';\nimport { takeUntil } from 'rxjs/operators';\n\n@Component({\n selector: 'p-contextMenuSub',\n template: `\n \n `,\n encapsulation: ViewEncapsulation.None\n})\nexport class ContextMenuSub {\n\n @Input() item: MenuItem;\n\n @Input() root: boolean;\n\n @Input() parentItemKey: any;\n\n @Output() leafClick: EventEmitter = new EventEmitter();\n\n @ViewChild('sublist') sublistViewChild: ElementRef;\n\n @ViewChild('menuitem') menuitemViewChild: ElementRef;\n\n contextMenu: ContextMenu;\n\n activeItemKey: string;\n\n hideTimeout: any;\n\n activeItemKeyChangeSubscription: Subscription;\n\n constructor(@Inject(forwardRef(() => ContextMenu)) contextMenu) {\n this.contextMenu = contextMenu as ContextMenu;\n }\n\n ngOnInit() {\n this.activeItemKeyChangeSubscription = this.contextMenu.contextMenuService.activeItemKeyChange$.pipe(takeUntil(this.contextMenu.ngDestroy$)).subscribe((activeItemKey) => {\n this.activeItemKey = activeItemKey;\n\n if (this.isActive(this.parentItemKey) && DomHandler.hasClass(this.sublistViewChild.nativeElement, 'p-submenu-list-active')) {\n this.contextMenu.positionSubmenu(this.sublistViewChild.nativeElement);\n }\n\n this.contextMenu.cd.markForCheck();\n });\n }\n\n onItemMouseEnter(event, item, key) {\n if (this.hideTimeout) {\n clearTimeout(this.hideTimeout);\n this.hideTimeout = null;\n }\n\n if (item.disabled) {\n return;\n }\n\n if (item.items) {\n let childSublist = DomHandler.findSingle(event.currentTarget, '.p-submenu-list');\n DomHandler.addClass(childSublist, 'p-submenu-list-active');\n }\n\n this.contextMenu.contextMenuService.changeKey(key);\n }\n\n onItemMouseLeave(event, item) {\n if (item.disabled) {\n return;\n }\n\n if (this.contextMenu.el.nativeElement.contains( event.toElement)) {\n if (item.items) {\n this.contextMenu.removeActiveFromSubLists(event.currentTarget);\n }\n\n if (!this.root) {\n this.contextMenu.contextMenuService.changeKey(this.parentItemKey);\n }\n }\n }\n\n onItemClick(event, item, menuitem, key) {\n if (item.disabled) {\n event.preventDefault();\n return;\n }\n\n if (!item.url && !item.routerLink) {\n event.preventDefault();\n }\n\n if (item.command) {\n item.command({\n originalEvent: event,\n item: item\n });\n }\n\n if (item.items) {\n let childSublist = DomHandler.findSingle(menuitem, '.p-submenu-list');\n\n if (childSublist) {\n if (this.isActive(key) && DomHandler.hasClass(childSublist, 'p-submenu-list-active')) {\n this.contextMenu.removeActiveFromSubLists(menuitem);\n }\n else {\n DomHandler.addClass(childSublist, 'p-submenu-list-active');\n }\n\n this.contextMenu.contextMenuService.changeKey(key);\n }\n }\n\n if (!item.items) {\n this.onLeafClick();\n }\n }\n\n onLeafClick() {\n if (this.root) {\n this.contextMenu.hide();\n }\n\n this.leafClick.emit();\n }\n\n getKey(index) {\n return this.root ? String(index) : this.parentItemKey + '_' + index;\n }\n\n isActive(key) {\n return (this.activeItemKey && this.activeItemKey.startsWith(key));\n }\n}\n\n@Component({\n selector: 'p-contextMenu',\n template: `\n
\n \n
\n `,\n changeDetection: ChangeDetectionStrategy.OnPush,\n encapsulation: ViewEncapsulation.None,\n styleUrls: ['./contextmenu.css']\n})\nexport class ContextMenu implements AfterViewInit, OnDestroy {\n\n @Input() model: MenuItem[];\n\n @Input() global: boolean;\n\n @Input() target: any;\n\n @Input() style: any;\n\n @Input() styleClass: string;\n\n @Input() appendTo: any;\n\n @Input() autoZIndex: boolean = true;\n\n @Input() baseZIndex: number = 0;\n\n @Input() triggerEvent: string = 'contextmenu';\n\n @Output() onShow: EventEmitter = new EventEmitter();\n\n @Output() onHide: EventEmitter = new EventEmitter();\n\n @ViewChild('container') containerViewChild: ElementRef;\n\n documentClickListener: any;\n\n documentKeydownListener: any;\n\n windowResizeListener: any;\n\n triggerEventListener: any;\n\n ngDestroy$ = new Subject();\n\n constructor(public el: ElementRef, public renderer: Renderer2, public cd: ChangeDetectorRef, public zone: NgZone, public contextMenuService: ContextMenuService) { }\n\n ngAfterViewInit() {\n if (this.global) {\n const documentTarget: any = this.el ? this.el.nativeElement.ownerDocument : 'document';\n\n this.triggerEventListener = this.renderer.listen(documentTarget, this.triggerEvent, (event) => {\n this.show(event);\n event.preventDefault();\n });\n }\n else if (this.target) {\n this.triggerEventListener = this.renderer.listen(this.target, this.triggerEvent, (event) => {\n this.show(event);\n event.preventDefault();\n event.stopPropagation();\n });\n }\n\n if (this.appendTo) {\n if (this.appendTo === 'body')\n document.body.appendChild(this.containerViewChild.nativeElement);\n else\n DomHandler.appendChild(this.containerViewChild.nativeElement, this.appendTo);\n }\n }\n\n show(event?: MouseEvent) {\n this.clearActiveItem();\n this.position(event);\n this.moveOnTop();\n this.containerViewChild.nativeElement.style.display = 'block';\n DomHandler.fadeIn(this.containerViewChild.nativeElement, 250);\n this.bindGlobalListeners();\n\n if (event) {\n event.preventDefault();\n }\n\n this.onShow.emit();\n }\n\n hide() {\n this.containerViewChild.nativeElement.style.display = 'none';\n this.unbindGlobalListeners();\n this.onHide.emit();\n }\n\n moveOnTop() {\n if (this.autoZIndex) {\n this.containerViewChild.nativeElement.style.zIndex = String(this.baseZIndex + (++DomHandler.zindex));\n }\n }\n\n toggle(event?: MouseEvent) {\n if (this.containerViewChild.nativeElement.offsetParent)\n this.hide();\n else\n this.show(event);\n }\n\n position(event?: MouseEvent) {\n if (event) {\n let left = event.pageX + 1;\n let top = event.pageY + 1;\n let width = this.containerViewChild.nativeElement.offsetParent ? this.containerViewChild.nativeElement.offsetWidth : DomHandler.getHiddenElementOuterWidth(this.containerViewChild.nativeElement);\n let height = this.containerViewChild.nativeElement.offsetParent ? this.containerViewChild.nativeElement.offsetHeight : DomHandler.getHiddenElementOuterHeight(this.containerViewChild.nativeElement);\n let viewport = DomHandler.getViewport();\n\n //flip\n if (left + width - document.body.scrollLeft > viewport.width) {\n left -= width;\n }\n\n //flip\n if (top + height - document.body.scrollTop > viewport.height) {\n top -= height;\n }\n\n //fit\n if (left < document.body.scrollLeft) {\n left = document.body.scrollLeft;\n }\n\n //fit\n if (top < document.body.scrollTop) {\n top = document.body.scrollTop;\n }\n\n this.containerViewChild.nativeElement.style.left = left + 'px';\n this.containerViewChild.nativeElement.style.top = top + 'px';\n }\n }\n\n positionSubmenu(sublist) {\n let parentMenuItem = sublist.parentElement.parentElement;\n let viewport = DomHandler.getViewport();\n let sublistWidth = sublist.offsetParent ? sublist.offsetWidth : DomHandler.getHiddenElementOuterWidth(sublist);\n let sublistHeight = sublist.offsetHeight ? sublist.offsetHeight : DomHandler.getHiddenElementOuterHeight(sublist);\n let itemOuterWidth = DomHandler.getOuterWidth(parentMenuItem.children[0]);\n let itemOuterHeight = DomHandler.getOuterHeight(parentMenuItem.children[0]);\n let containerOffset = DomHandler.getOffset(parentMenuItem.parentElement);\n\n sublist.style.zIndex = ++DomHandler.zindex;\n\n if ((parseInt(containerOffset.top) + itemOuterHeight + sublistHeight) > (viewport.height - DomHandler.calculateScrollbarHeight())) {\n sublist.style.removeProperty('top');\n sublist.style.bottom = '0px';\n }\n else {\n sublist.style.removeProperty('bottom');\n sublist.style.top = '0px';\n }\n\n if ((parseInt(containerOffset.left) + itemOuterWidth + sublistWidth) > (viewport.width - DomHandler.calculateScrollbarWidth())) {\n sublist.style.left = -sublistWidth + 'px';\n }\n else {\n sublist.style.left = itemOuterWidth + 'px';\n }\n }\n\n isItemMatched(menuitem) {\n return DomHandler.hasClass(menuitem, 'p-menuitem') && !DomHandler.hasClass(menuitem.children[0], 'p-disabled');\n }\n\n findNextItem(menuitem, isRepeated?) {\n let nextMenuitem = menuitem.nextElementSibling;\n\n if (nextMenuitem) {\n return this.isItemMatched(nextMenuitem) ? nextMenuitem : this.findNextItem(nextMenuitem, isRepeated);\n }\n else {\n let firstItem = menuitem.parentElement.children[0];\n\n return this.isItemMatched(firstItem) ? firstItem : (!isRepeated ? this.findNextItem(firstItem, true) : null);\n }\n }\n\n findPrevItem(menuitem, isRepeated?) {\n let prevMenuitem = menuitem.previousElementSibling;\n\n if (prevMenuitem) {\n return this.isItemMatched(prevMenuitem) ? prevMenuitem : this.findPrevItem(prevMenuitem, isRepeated);\n }\n else {\n let lastItem = menuitem.parentElement.children[menuitem.parentElement.children.length - 1];\n\n return this.isItemMatched(lastItem) ? lastItem : (!isRepeated ? this.findPrevItem(lastItem, true) : null);\n }\n }\n\n getActiveItem() {\n let activeItemKey = this.contextMenuService.activeItemKey;\n\n return activeItemKey == null ? null : DomHandler.findSingle(this.containerViewChild.nativeElement, '.p-menuitem[data-ik=\"' + activeItemKey + '\"]');\n }\n\n clearActiveItem() {\n if (this.contextMenuService.activeItemKey) {\n this.removeActiveFromSubLists(this.containerViewChild.nativeElement);\n this.contextMenuService.reset();\n }\n }\n\n removeActiveFromSubLists(el) {\n let sublists = DomHandler.find(el, '.p-submenu-list-active');\n\n for (let sublist of sublists) {\n DomHandler.removeClass(sublist, 'p-submenu-list-active');\n }\n }\n\n removeActiveFromSublist(menuitem) {\n if (menuitem) {\n let sublist = DomHandler.findSingle(menuitem, '.p-submenu-list');\n\n if (sublist && DomHandler.hasClass(menuitem, 'p-submenu-list-active')) {\n DomHandler.removeClass(menuitem, 'p-submenu-list-active');\n }\n }\n }\n\n bindGlobalListeners() {\n if (!this.documentClickListener) {\n const documentTarget: any = this.el ? this.el.nativeElement.ownerDocument : 'document';\n\n this.documentClickListener = this.renderer.listen(documentTarget, 'click', (event) => {\n if (this.containerViewChild.nativeElement.offsetParent && this.isOutsideClicked(event) && event.button !== 2) {\n this.hide();\n }\n });\n }\n\n this.zone.runOutsideAngular(() => {\n if (!this.windowResizeListener) {\n this.windowResizeListener = this.onWindowResize.bind(this);\n window.addEventListener('resize', this.windowResizeListener);\n }\n });\n\n if (!this.documentKeydownListener) {\n const documentTarget: any = this.el ? this.el.nativeElement.ownerDocument : 'document';\n\n this.documentKeydownListener = this.renderer.listen(documentTarget, 'keydown', (event) => {\n let activeItem = this.getActiveItem();\n\n switch (event.key) {\n case 'ArrowDown':\n if (activeItem) {\n this.removeActiveFromSublist(activeItem);\n activeItem = this.findNextItem(activeItem);\n }\n else {\n let firstItem = DomHandler.findSingle(this.containerViewChild.nativeElement, '.p-menuitem-link').parentElement;\n activeItem = this.isItemMatched(firstItem) ? firstItem : this.findNextItem(firstItem);\n }\n\n if (activeItem) {\n this.contextMenuService.changeKey(activeItem.getAttribute('data-ik'));\n }\n\n event.preventDefault();\n break;\n\n case 'ArrowUp':\n if (activeItem) {\n this.removeActiveFromSublist(activeItem);\n activeItem = this.findPrevItem(activeItem);\n }\n else {\n let sublist = DomHandler.findSingle(this.containerViewChild.nativeElement, 'ul');\n let lastItem = sublist.children[sublist.children.length - 1];\n activeItem = this.isItemMatched(lastItem) ? lastItem : this.findPrevItem(lastItem);\n }\n\n if (activeItem) {\n this.contextMenuService.changeKey(activeItem.getAttribute('data-ik'));\n }\n\n event.preventDefault();\n break;\n\n case 'ArrowRight':\n if (activeItem) {\n let sublist = DomHandler.findSingle(activeItem, '.p-submenu-list');\n\n if (sublist) {\n DomHandler.addClass(sublist, 'p-submenu-list-active');\n\n activeItem = DomHandler.findSingle(sublist, '.p-menuitem-link:not(.p-disabled)').parentElement;\n\n if (activeItem) {\n this.contextMenuService.changeKey(activeItem.getAttribute('data-ik'));\n }\n }\n }\n\n event.preventDefault();\n break;\n\n case 'ArrowLeft':\n if (activeItem) {\n let sublist = activeItem.parentElement;\n\n if (sublist && DomHandler.hasClass(sublist, 'p-submenu-list-active')) {\n DomHandler.removeClass(sublist, 'p-submenu-list-active');\n\n activeItem = sublist.parentElement.parentElement;\n\n if (activeItem) {\n this.contextMenuService.changeKey(activeItem.getAttribute('data-ik'));\n }\n }\n }\n\n event.preventDefault();\n break;\n\n case 'Escape':\n this.hide();\n event.preventDefault();\n\n break;\n\n case 'Enter':\n if (activeItem) {\n this.handleItemClick(event, this.findModelItemFromKey(this.contextMenuService.activeItemKey), activeItem);\n }\n\n event.preventDefault();\n break;\n\n default:\n break;\n }\n });\n }\n }\n\n findModelItemFromKey(key) {\n if (key == null || !this.model) {\n return null;\n }\n\n let indexes = key.split('_');\n return indexes.reduce((item, currentIndex) => {\n return item ? item.items[currentIndex] : this.model[currentIndex];\n }, null);\n }\n\n handleItemClick(event, item, menuitem) {\n if (!item || item.disabled) {\n return;\n }\n\n if (item.command) {\n item.command({\n originalEvent: event,\n item: item\n });\n }\n\n if (item.items) {\n let childSublist = DomHandler.findSingle(menuitem, '.p-submenu-list');\n\n if (childSublist) {\n if (DomHandler.hasClass(childSublist, 'p-submenu-list-active')) {\n this.removeActiveFromSubLists(menuitem);\n }\n else {\n DomHandler.addClass(childSublist, 'p-submenu-list-active');\n this.positionSubmenu(childSublist);\n }\n }\n }\n\n if (!item.items) {\n this.hide();\n }\n }\n\n unbindGlobalListeners() {\n if (this.documentClickListener) {\n this.documentClickListener();\n this.documentClickListener = null;\n }\n\n if (this.windowResizeListener) {\n window.removeEventListener('resize', this.windowResizeListener);\n this.windowResizeListener = null;\n }\n\n if (this.documentKeydownListener) {\n this.documentKeydownListener();\n this.documentKeydownListener = null;\n }\n }\n\n onWindowResize(event) {\n if (this.containerViewChild.nativeElement.offsetParent) {\n this.hide();\n }\n }\n\n isOutsideClicked(event: Event) {\n return !(this.containerViewChild.nativeElement.isSameNode(event.target) || this.containerViewChild.nativeElement.contains(event.target));\n }\n\n ngOnDestroy() {\n this.unbindGlobalListeners();\n\n if (this.triggerEventListener) {\n this.triggerEventListener();\n }\n\n if (this.appendTo) {\n this.el.nativeElement.appendChild(this.containerViewChild.nativeElement);\n }\n\n this.ngDestroy$.next(true);\n this.ngDestroy$.complete();\n }\n\n}\n\n@NgModule({\n imports: [CommonModule,RouterModule,RippleModule],\n exports: [ContextMenu,RouterModule],\n declarations: [ContextMenu,ContextMenuSub],\n providers: [ContextMenuService]\n})\nexport class ContextMenuModule { }\n"]}