UNPKG

@syncfusion/ej2-navigations

Version:

A package of Essential JS 2 navigation components such as Tree-view, Tab, Toolbar, Context-menu, and Accordion which is used to navigate from one page to another

10 lines 443 kB
/*! * filename: ej2-navigations.min.js * version : 30.2.5 * Copyright Syncfusion Inc. 2001 - 2024. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing * licensing@syncfusion.com. Any infringement will be prosecuted under * applicable laws. */ this.ej=this.ej||{},this.ej.navigations=function(e,t,i,s,n,r,a){"use strict";function o(e,t,i,s,n,r){var a,o,d=t.parentElement;if("vscroll"===s?(a=r||t.getBoundingClientRect().height,o=i.getBoundingClientRect().height):(a=t.getBoundingClientRect().width,o=i.getBoundingClientRect().width),a<o)return l(e,t,i,s,n,r);if(d){var h=d.getBoundingClientRect().width;return h<a&&"hscroll"===s?(o=h,t.style.maxWidth=h+"px",l(e,t,i,s,n,r)):i}return i}function l(e,i,s,n,r,a){var o=e("div",{className:"e-menu-"+n});i.appendChild(o),o.appendChild(s),a?(o.style.overflow="hidden",o.style.height=a+"px"):(o.style.maxHeight=i.style.maxHeight,i.style.overflow="hidden");return"vscroll"===n?new m({enableRtl:r},o).scrollStep=t.select(".e-"+n+"-bar",i).offsetHeight/2:new p({enableRtl:r},o).scrollStep=t.select(".e-"+n+"-bar",i).offsetWidth,o}function d(e,i,s){if(e){var n=t.select(".e-menu-parent",i);n?s&&s!==n||(e.destroy(),i.parentElement.appendChild(n),t.detach(i)):(e.destroy(),t.detach(i))}}var h=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),c=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a},p=function(e){function i(t,i){return e.call(this,t,i)||this}return h(i,e),i.prototype.preRender=function(){this.browser=t.Browser.info.name,this.browserCheck="mozilla"===this.browser,this.isDevice=t.Browser.isDevice,this.customStep=!0;var e=this.element;this.ieCheck="edge"===this.browser||"msie"===this.browser,this.initialize(),""===e.id&&(e.id=t.getUniqueID("hscroll"),this.uniqueId=!0),e.style.display="block",this.enableRtl&&e.classList.add("e-rtl")},i.prototype.render=function(){this.touchModule=new t.Touch(this.element,{scroll:this.touchHandler.bind(this),swipe:this.swipeHandler.bind(this)}),t.EventHandler.add(this.scrollEle,"scroll",this.scrollHandler,this),this.isDevice?(this.element.classList.add("e-scroll-device"),this.createOverlay(this.element)):this.createNavIcon(this.element),this.setScrollState()},i.prototype.setScrollState=function(){t.isNullOrUndefined(this.scrollStep)||this.scrollStep<0?(this.scrollStep=this.scrollEle.offsetWidth,this.customStep=!1):this.customStep=!0},i.prototype.initialize=function(){var e=this.createElement("div",{className:"e-hscroll-content"}),t=this.createElement("div",{className:"e-hscroll-bar"});t.setAttribute("tabindex","-1");for(var i=this.element,s=0,n=[].slice.call(i.children);s<n.length;s++){var r=n[s];e.appendChild(r)}t.appendChild(e),i.appendChild(t),t.style.overflowX="hidden",this.scrollEle=t,this.scrollItems=e},i.prototype.getPersistData=function(){var e=["scrollStep"];return this.addOnPersist(e)},i.prototype.getModuleName=function(){return"hScroll"},i.prototype.destroy=function(){var i=this.element;i.style.display="",i.classList.remove("e-hscroll"),i.classList.remove("e-scroll-device"),i.classList.remove("e-rtl");var s=t.selectAll(".e-"+i.id+"_nav.e-scroll-nav",i),n=t.selectAll(".e-scroll-overlay",i);[].slice.call(n).forEach(function(e){t.detach(e)});for(var r=0,a=[].slice.call(this.scrollItems.children);r<a.length;r++){var o=a[r];i.appendChild(o)}this.uniqueId&&this.element.removeAttribute("id"),t.detach(this.scrollEle),s.length>0&&(t.detach(s[0]),t.isNullOrUndefined(s[1])||t.detach(s[1])),t.EventHandler.remove(this.scrollEle,"scroll",this.scrollHandler),this.touchModule.destroy(),this.touchModule=null,e.prototype.destroy.call(this)},i.prototype.disable=function(e){var i=t.selectAll(".e-scroll-nav:not(.e-overlay)",this.element);e?this.element.classList.add("e-overlay"):this.element.classList.remove("e-overlay"),[].slice.call(i).forEach(function(t){t.setAttribute("tabindex",e?"-1":"0")})},i.prototype.createOverlay=function(e){var t=e.id.concat("_nav"),i=this.createElement("div",{className:"e-scroll-overlay e-scroll-right-overlay"}),s="e-"+e.id.concat("_nav e-scroll-nav e-scroll-right-nav"),n=this.createElement("div",{id:t.concat("_right"),className:s}),r=this.createElement("div",{className:"e-nav-right-arrow e-nav-arrow e-icons"});n.appendChild(r);var a=this.createElement("div",{className:"e-scroll-overlay e-scroll-left-overlay"});this.ieCheck&&n.classList.add("e-ie-align"),e.appendChild(i),e.appendChild(n),e.insertBefore(a,e.firstChild),this.eventBinding([n])},i.prototype.createNavIcon=function(e){var t=e.id.concat("_nav"),i="e-"+e.id.concat("_nav e-scroll-nav e-scroll-right-nav"),s={role:"button",id:t.concat("_right"),"aria-label":"Scroll right"},n=this.createElement("div",{className:i,attrs:s});n.setAttribute("aria-disabled","false");var r=this.createElement("div",{className:"e-nav-right-arrow e-nav-arrow e-icons"}),a="e-"+e.id.concat("_nav e-scroll-nav e-scroll-left-nav"),o={role:"button",id:t.concat("_left"),"aria-label":"Scroll left"},l=this.createElement("div",{className:a+" e-overlay",attrs:o});l.setAttribute("aria-disabled","true");var d=this.createElement("div",{className:"e-nav-left-arrow e-nav-arrow e-icons"});l.appendChild(d),n.appendChild(r),e.appendChild(n),e.insertBefore(l,e.firstChild),this.ieCheck&&(n.classList.add("e-ie-align"),l.classList.add("e-ie-align")),this.eventBinding([n,l])},i.prototype.onKeyPress=function(e){var t=this;if("Enter"===e.key){var i=function(){t.keyTimeout=!0,t.eleScrolling(10,e.target,!0)};this.keyTimer=window.setTimeout(function(){i()},100)}},i.prototype.onKeyUp=function(e){"Enter"===e.key&&(this.keyTimeout?this.keyTimeout=!1:e.target.click(),clearTimeout(this.keyTimer))},i.prototype.eventBinding=function(e){var i=this;[].slice.call(e).forEach(function(e){new t.Touch(e,{tapHold:i.tabHoldHandler.bind(i),tapHoldThreshold:500}),e.addEventListener("keydown",i.onKeyPress.bind(i)),e.addEventListener("keyup",i.onKeyUp.bind(i)),e.addEventListener("mouseup",i.repeatScroll.bind(i)),e.addEventListener("touchend",i.repeatScroll.bind(i)),e.addEventListener("contextmenu",function(e){e.preventDefault()}),t.EventHandler.add(e,"click",i.clickEventHandler,i)})},i.prototype.repeatScroll=function(){clearInterval(this.timeout)},i.prototype.tabHoldHandler=function(e){var t=this,i=e.originalEvent.target;i=this.contains(i,"e-scroll-nav")?i.firstElementChild:i;var s=function(){t.eleScrolling(10,i,!0)};this.timeout=window.setInterval(function(){s()},50)},i.prototype.contains=function(e,t){return e.classList.contains(t)},i.prototype.eleScrolling=function(e,t,i){var s=this.element,n=t.classList;n.contains("e-scroll-nav")&&(n=t.querySelector(".e-nav-arrow").classList),this.contains(s,"e-rtl")&&this.browserCheck&&(e=-e),!this.contains(s,"e-rtl")||this.browserCheck||this.ieCheck?n.contains("e-nav-right-arrow")?this.frameScrollRequest(e,"add",i):this.frameScrollRequest(e,"",i):n.contains("e-nav-left-arrow")?this.frameScrollRequest(e,"add",i):this.frameScrollRequest(e,"",i)},i.prototype.clickEventHandler=function(e){this.eleScrolling(this.scrollStep,e.target,!1)},i.prototype.swipeHandler=function(e){var t,i=this.scrollEle;t=e.velocity<=1?e.distanceX/(10*e.velocity):e.distanceX/e.velocity;var s=.5,n=function(){var r=Math.sin(s);r<=0?window.cancelAnimationFrame(r):("Left"===e.swipeDirection?i.scrollLeft+=t*r:"Right"===e.swipeDirection&&(i.scrollLeft-=t*r),s-=.5,window.requestAnimationFrame(n))};n()},i.prototype.scrollUpdating=function(e,t){"add"===t?this.scrollEle.scrollLeft+=e:this.scrollEle.scrollLeft-=e,this.enableRtl&&this.scrollEle.scrollLeft>0&&(this.scrollEle.scrollLeft=0)},i.prototype.frameScrollRequest=function(e,i,s){var n=this;if(s)return void this.scrollUpdating(e,i);this.customStep||[].slice.call(t.selectAll(".e-scroll-overlay",this.element)).forEach(function(t){e-=t.offsetWidth});var r=function(){var t,s;n.contains(n.element,"e-rtl")&&n.browserCheck?(t=-e,s=-10):(t=e,s=10),t<10?window.cancelAnimationFrame(s):(n.scrollUpdating(s,i),e-=s,window.requestAnimationFrame(r))};r()},i.prototype.touchHandler=function(e){var t=this.scrollEle,i=e.distanceX;this.ieCheck&&this.contains(this.element,"e-rtl")&&(i=-i),"Left"===e.scrollDirection?t.scrollLeft=t.scrollLeft+i:"Right"===e.scrollDirection&&(t.scrollLeft=t.scrollLeft-i)},i.prototype.arrowDisabling=function(e,i){if(this.isDevice){var s=(t.isNullOrUndefined(e)?i:e).querySelector(".e-nav-arrow");t.isNullOrUndefined(e)?t.classList(s,["e-nav-right-arrow"],["e-nav-left-arrow"]):t.classList(s,["e-nav-left-arrow"],["e-nav-right-arrow"])}else e&&i&&(e.classList.add("e-overlay"),e.setAttribute("aria-disabled","true"),e.removeAttribute("tabindex"),i.classList.remove("e-overlay"),i.setAttribute("aria-disabled","false"),i.setAttribute("tabindex","0"));this.repeatScroll()},i.prototype.scrollHandler=function(e){var t=e.target,i=t.offsetWidth,s=(this.element,this.element.querySelector(".e-scroll-left-nav")),n=this.element.querySelector(".e-scroll-right-nav"),r=this.element.querySelector(".e-scroll-left-overlay"),a=this.element.querySelector(".e-scroll-right-overlay"),o=t.scrollLeft;if(o<=0&&(o=-o),this.isDevice&&(!this.enableRtl||this.browserCheck||this.ieCheck||(r=this.element.querySelector(".e-scroll-right-overlay"),a=this.element.querySelector(".e-scroll-left-overlay")),r.style.width=o<40?o+"px":"40px",t.scrollWidth-Math.ceil(i+o)<40?a.style.width=t.scrollWidth-Math.ceil(i+o)+"px":a.style.width="40px"),0===o)this.arrowDisabling(s,n);else if(Math.ceil(i+o+.1)>=t.scrollWidth)this.arrowDisabling(n,s);else{var l=this.element.querySelector(".e-scroll-nav.e-overlay");l&&(l.classList.remove("e-overlay"),l.setAttribute("aria-disabled","false"),l.setAttribute("tabindex","0"))}},i.prototype.onPropertyChanged=function(e,t){for(var i=0,s=Object.keys(e);i<s.length;i++)switch(s[i]){case"scrollStep":this.setScrollState();break;case"enableRtl":e.enableRtl?this.element.classList.add("e-rtl"):this.element.classList.remove("e-rtl")}},c([t.Property(null)],i.prototype,"scrollStep",void 0),i=c([t.NotifyPropertyChanges],i)}(t.Component),u=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),f=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a},m=function(e){function i(t,i){return e.call(this,t,i)||this}return u(i,e),i.prototype.preRender=function(){this.browser=t.Browser.info.name,this.browserCheck="mozilla"===this.browser,this.isDevice=t.Browser.isDevice,this.customStep=!0;var e=this.element;this.ieCheck="edge"===this.browser||"msie"===this.browser,this.initialize(),""===e.id&&(e.id=t.getUniqueID("vscroll"),this.uniqueId=!0),e.style.display="block",this.enableRtl&&e.classList.add("e-rtl")},i.prototype.render=function(){this.touchModule=new t.Touch(this.element,{scroll:this.touchHandler.bind(this),swipe:this.swipeHandler.bind(this)}),t.EventHandler.add(this.scrollEle,"scroll",this.scrollEventHandler,this),this.isDevice?(this.element.classList.add("e-scroll-device"),this.createOverlayElement(this.element)):this.createNavIcon(this.element),this.setScrollState(),t.EventHandler.add(this.element,"wheel",this.wheelEventHandler,this)},i.prototype.setScrollState=function(){t.isNullOrUndefined(this.scrollStep)||this.scrollStep<0?(this.scrollStep=this.scrollEle.offsetHeight,this.customStep=!1):this.customStep=!0},i.prototype.initialize=function(){var e=t.createElement("div",{className:"e-vscroll-content"}),i=t.createElement("div",{className:"e-vscroll-bar"});i.setAttribute("tabindex","-1");for(var s=this.element,n=0,r=[].slice.call(s.children);n<r.length;n++){var a=r[n];e.appendChild(a)}i.appendChild(e),s.appendChild(i),i.style.overflow="hidden",this.scrollEle=i,this.scrollItems=e},i.prototype.getPersistData=function(){var e=["scrollStep"];return this.addOnPersist(e)},i.prototype.getModuleName=function(){return"vScroll"},i.prototype.destroy=function(){var i=this.element;i.style.display="",t.removeClass([this.element],["e-vscroll","e-scroll-device","e-rtl"]);var s=t.selectAll(".e-"+i.id+"_nav.e-scroll-nav",i),n=t.selectAll(".e-scroll-overlay",i);[].slice.call(n).forEach(function(e){t.detach(e)});for(var r=0,a=[].slice.call(this.scrollItems.children);r<a.length;r++){var o=a[r];i.appendChild(o)}this.uniqueId&&this.element.removeAttribute("id"),t.detach(this.scrollEle),s.length>0&&(t.detach(s[0]),t.isNullOrUndefined(s[1])||t.detach(s[1])),t.EventHandler.remove(this.scrollEle,"scroll",this.scrollEventHandler),this.touchModule.destroy(),this.touchModule=null,e.prototype.destroy.call(this)},i.prototype.disable=function(e){var i=t.selectAll(".e-scroll-nav:not(.e-overlay)",this.element);e?this.element.classList.add("e-overlay"):this.element.classList.remove("e-overlay"),[].slice.call(i).forEach(function(t){t.setAttribute("tabindex",e?"-1":"0")})},i.prototype.createOverlayElement=function(e){var i=e.id.concat("_nav"),s=t.createElement("div",{className:"e-scroll-overlay e-scroll-down-overlay"}),n="e-"+e.id.concat("_nav e-scroll-nav e-scroll-down-nav"),r=t.createElement("div",{id:i.concat("down"),className:n}),a=t.createElement("div",{className:"e-nav-down-arrow e-nav-arrow e-icons"});r.appendChild(a);var o=t.createElement("div",{className:"e-scroll-overlay e-scroll-up-overlay"});this.ieCheck&&r.classList.add("e-ie-align"),e.appendChild(s),e.appendChild(r),e.insertBefore(o,e.firstChild),this.eventBinding([r])},i.prototype.createNavIcon=function(e){var i=e.id.concat("_nav"),s="e-"+e.id.concat("_nav e-scroll-nav e-scroll-down-nav"),n=t.createElement("div",{id:i.concat("_down"),className:s});n.setAttribute("aria-disabled","false");var r=t.createElement("div",{className:"e-nav-down-arrow e-nav-arrow e-icons"}),a="e-"+e.id.concat("_nav e-scroll-nav e-scroll-up-nav"),o=t.createElement("div",{id:i.concat("_up"),className:a+" e-overlay"});o.setAttribute("aria-disabled","true");var l=t.createElement("div",{className:"e-nav-up-arrow e-nav-arrow e-icons"});o.appendChild(l),n.appendChild(r),n.setAttribute("tabindex","0"),e.appendChild(n),e.insertBefore(o,e.firstChild),this.ieCheck&&(n.classList.add("e-ie-align"),o.classList.add("e-ie-align")),this.eventBinding([n,o])},i.prototype.onKeyPress=function(e){var t=this;if("Enter"===e.key){var i=function(){t.keyTimeout=!0,t.eleScrolling(10,e.target,!0)};this.keyTimer=window.setTimeout(function(){i()},100)}},i.prototype.onKeyUp=function(e){"Enter"===e.key&&(this.keyTimeout?this.keyTimeout=!1:e.target.click(),clearTimeout(this.keyTimer))},i.prototype.eventBinding=function(e){var i=this;[].slice.call(e).forEach(function(e){new t.Touch(e,{tapHold:i.tabHoldHandler.bind(i),tapHoldThreshold:500}),e.addEventListener("keydown",i.onKeyPress.bind(i)),e.addEventListener("keyup",i.onKeyUp.bind(i)),e.addEventListener("mouseup",i.repeatScroll.bind(i)),e.addEventListener("touchend",i.repeatScroll.bind(i)),e.addEventListener("contextmenu",function(e){e.preventDefault()}),t.EventHandler.add(e,"click",i.clickEventHandler,i)})},i.prototype.repeatScroll=function(){clearInterval(this.timeout)},i.prototype.tabHoldHandler=function(e){var t=this,i=e.originalEvent.target;i=this.contains(i,"e-scroll-nav")?i.firstElementChild:i;var s=function(){t.eleScrolling(10,i,!0)};this.timeout=window.setInterval(function(){s()},50)},i.prototype.contains=function(e,t){return e.classList.contains(t)},i.prototype.eleScrolling=function(e,t,i){var s=t.classList;s.contains("e-scroll-nav")&&(s=t.querySelector(".e-nav-arrow").classList),s.contains("e-nav-down-arrow")?this.frameScrollRequest(e,"add",i):s.contains("e-nav-up-arrow")&&this.frameScrollRequest(e,"",i)},i.prototype.clickEventHandler=function(e){this.eleScrolling(this.scrollStep,e.target,!1)},i.prototype.wheelEventHandler=function(e){e.preventDefault(),this.frameScrollRequest(this.scrollStep,e.deltaY>0?"add":"",!1)},i.prototype.swipeHandler=function(e){var t,i=this.scrollEle;t=e.velocity<=1?e.distanceY/(10*e.velocity):e.distanceY/e.velocity;var s=.5,n=function(){var r=Math.sin(s);r<=0?window.cancelAnimationFrame(r):("Up"===e.swipeDirection?i.scrollTop+=t*r:"Down"===e.swipeDirection&&(i.scrollTop-=t*r),s-=.02,window.requestAnimationFrame(n))};n()},i.prototype.scrollUpdating=function(e,t){"add"===t?this.scrollEle.scrollTop+=e:this.scrollEle.scrollTop-=e},i.prototype.frameScrollRequest=function(e,i,s){var n=this;if(s)return void this.scrollUpdating(e,i);this.customStep||[].slice.call(t.selectAll(".e-scroll-overlay",this.element)).forEach(function(t){e-=t.offsetHeight});var r=function(){e<10?window.cancelAnimationFrame(10):(n.scrollUpdating(10,i),e-=10,window.requestAnimationFrame(r))};r()},i.prototype.touchHandler=function(e){var t=this.scrollEle,i=e.distanceY;"Up"===e.scrollDirection?t.scrollTop=t.scrollTop+i:"Down"===e.scrollDirection&&(t.scrollTop=t.scrollTop-i)},i.prototype.arrowDisabling=function(e,i){if(this.isDevice){var s=(t.isNullOrUndefined(e)?i:e).querySelector(".e-nav-arrow");t.isNullOrUndefined(e)?t.classList(s,["e-nav-down-arrow"],["e-nav-up-arrow"]):t.classList(s,["e-nav-up-arrow"],["e-nav-down-arrow"])}else e.classList.add("e-overlay"),e.setAttribute("aria-disabled","true"),e.removeAttribute("tabindex"),i.classList.remove("e-overlay"),i.setAttribute("aria-disabled","false"),i.setAttribute("tabindex","0");this.repeatScroll()},i.prototype.scrollEventHandler=function(e){var t=e.target,i=t.offsetHeight,s=this.element.querySelector(".e-scroll-up-nav"),n=this.element.querySelector(".e-scroll-down-nav"),r=this.element.querySelector(".e-scroll-up-overlay"),a=this.element.querySelector(".e-scroll-down-overlay"),o=t.scrollTop;if(o<=0&&(o=-o),this.isDevice&&(r.style.height=o<40?o+"px":"40px",t.scrollHeight-Math.ceil(i+o)<40?a.style.height=t.scrollHeight-Math.ceil(i+o)+"px":a.style.height="40px"),0===o)this.arrowDisabling(s,n);else if(Math.ceil(i+o+.1)>=t.scrollHeight)this.arrowDisabling(n,s);else{var l=this.element.querySelector(".e-scroll-nav.e-overlay");l&&(l.classList.remove("e-overlay"),l.setAttribute("aria-disabled","false"),l.setAttribute("tabindex","0"))}},i.prototype.onPropertyChanged=function(e,t){for(var i=0,s=Object.keys(e);i<s.length;i++)switch(s[i]){case"scrollStep":this.setScrollState();break;case"enableRtl":e.enableRtl?this.element.classList.add("e-rtl"):this.element.classList.remove("e-rtl")}},f([t.Property(null)],i.prototype,"scrollStep",void 0),i=f([t.NotifyPropertyChanges],i)}(t.Component),g=function(){var e=function(t,i){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])})(t,i)};return function(t,i){function s(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(s.prototype=i.prototype,new s)}}(),v=function(e,t,i,s){var n,r=arguments.length,a=r<3?t:null===s?s=Object.getOwnPropertyDescriptor(t,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,i,s);else for(var o=e.length-1;o>=0;o--)(n=e[o])&&(a=(r<3?n(a):r>3?n(t,i,a):n(t,i))||a);return r>3&&a&&Object.defineProperty(t,i,a),a},y="e-focused",b="e-menu-header",C="e-selected",S="e-menu-item",I="e-menu-hide",x="e-menu-popup",E=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return g(i,e),v([t.Property("id")],i.prototype,"itemId",void 0),v([t.Property("parentId")],i.prototype,"parentId",void 0),v([t.Property("text")],i.prototype,"text",void 0),v([t.Property("iconCss")],i.prototype,"iconCss",void 0),v([t.Property("url")],i.prototype,"url",void 0),v([t.Property("separator")],i.prototype,"separator",void 0),v([t.Property("items")],i.prototype,"children",void 0),i}(t.ChildProperty),N=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return g(i,e),v([t.Property(null)],i.prototype,"iconCss",void 0),v([t.Property("")],i.prototype,"id",void 0),v([t.Property(!1)],i.prototype,"separator",void 0),v([t.Collection([],i)],i.prototype,"items",void 0),v([t.Property("")],i.prototype,"text",void 0),v([t.Property("")],i.prototype,"url",void 0),v([t.Property()],i.prototype,"htmlAttributes",void 0),i}(t.ChildProperty),O=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return g(i,e),v([t.Property("SlideDown")],i.prototype,"effect",void 0),v([t.Property(400)],i.prototype,"duration",void 0),v([t.Property("ease")],i.prototype,"easing",void 0),i}(t.ChildProperty),w=function(e){function n(i,s){var n=e.call(this,i,s)||this;return n.navIdx=[],n.animation=new t.Animation({}),n.isTapHold=!1,n.tempItem=[],n.showSubMenuOn="Auto",n.isAnimationNone=!1,n.isKBDAction=!1,n}return g(n,e),n.prototype.preRender=function(){if(!this.isMenu){r=void 0;if("EJS-CONTEXTMENU"===this.element.tagName){r=this.createElement("ul",{id:t.getUniqueID(this.getModuleName()),className:"e-control e-lib e-"+this.getModuleName()});var e=t.getValue("ej2_instances",this.element);t.removeClass([this.element],["e-control","e-lib","e-"+this.getModuleName()]),this.clonedElement=this.element,this.element=r,t.setValue("ej2_instances",e,this.element)}else{r=this.createElement("ul",{id:t.getUniqueID(this.getModuleName())}),t.append([].slice.call(this.element.cloneNode(!0).children),r);var i=this.element.nextElementSibling;i?this.element.parentElement.insertBefore(r,i):this.element.parentElement.appendChild(r),this.clonedElement=r}this.clonedElement.style.display="none"}if("EJS-MENU"===this.element.tagName){for(var s=this.element,n=t.getValue("ej2_instances",s),r=this.createElement("ul"),a=this.createElement("EJS-MENU",{className:"e-"+this.getModuleName()+"-wrapper"}),o=0,l=s.attributes.length;o<l;o++)r.setAttribute(s.attributes[o].nodeName,s.attributes[o].nodeValue);s.parentNode.insertBefore(a,s),t.detach(s),s=r,a.appendChild(s),t.setValue("ej2_instances",n,s),this.clonedElement=a,this.element=s,this.element.id||(this.element.id=t.getUniqueID(this.getModuleName()))}},n.prototype.render=function(){var e=this;this.initialize(),this.renderItems(),this.wireEvents(),this.renderComplete();var t=this.getWrapper();this.template&&this.enableScrolling&&(this.isReact||this.isAngular)&&requestAnimationFrame(function(){o(e.createElement,t,e.element,"hscroll",e.enableRtl)})},n.prototype.enableTouchScroll=function(e){var t=0;this.touchStartFn=function(e){t=e.touches[0].clientY},this.touchMoveFn=function(i){var s=i.touches[0].clientY,n=t-s,r=0===e.scrollTop,a=e.scrollTop+e.clientHeight===e.scrollHeight;(r&&n<0||a&&n>0)&&i.preventDefault(),t=s},e.addEventListener("touchstart",this.touchStartFn,{passive:!1}),e.addEventListener("touchmove",this.touchMoveFn,{passive:!1})},n.prototype.touchOutsideHandler=function(e){var i=e.target;t.closest(i,".e-"+this.getModuleName()+"-wrapper")||this.closeMenu()},n.prototype.initialize=function(){var e=this.getWrapper();e||(e=this.createElement("div",{className:"e-"+this.getModuleName()+"-wrapper"}),this.isMenu?this.element.parentElement.insertBefore(e,this.element):document.body.appendChild(e)),this.cssClass&&t.addClass([e],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.enableRtl&&e.classList.add("e-rtl"),e.appendChild(this.element),this.isMenu&&this.hamburgerMode&&(this.target||this.createHeaderContainer(e)),this.defaultOption=this.showItemOnClick},n.prototype.renderItems=function(){if(!this.items.length){var e=i.ListBase.createJsonFromElement(this.element,{fields:{child:"items"}});this.setProperties({items:e},!0),t.isBlazor()&&!this.isMenu?this.element=this.removeChildElement(this.element):this.element.innerHTML=""}var s=this.createItems(this.items);if(t.append(Array.prototype.slice.call(s.children),this.element),this.element.classList.add("e-menu-parent"),this.isMenu){if(!this.hamburgerMode&&this.element.classList.contains("e-vertical")&&this.setBlankIconStyle(this.element),this.enableScrolling){var n=this.getWrapper();this.element.classList.contains("e-vertical")?o(this.createElement,n,this.element,"vscroll",this.enableRtl):o(this.createElement,n,this.element,"hscroll",this.enableRtl)}}else this.element.parentElement.setAttribute("role","dialog"),this.element.parentElement.setAttribute("aria-label","context menu")},n.prototype.wireEvents=function(){var e=this.getWrapper();if(this.target){for(var i=void 0,n=t.selectAll(this.target),r=0,a=n.length;r<a;r++)i=n[r],this.isMenu?t.EventHandler.add(i,"click",this.menuHeaderClickHandler,this):t.Browser.isIos?new t.Touch(i,{tapHold:this.touchHandler.bind(this)}):t.EventHandler.add(i,"contextmenu",this.cmenuHandler,this);if(this.targetElement=i,!this.isMenu){t.EventHandler.add(this.targetElement,"scroll",this.scrollHandler,this);for(var o=0,l=s.getScrollableParent(this.targetElement);o<l.length;o++){var d=l[o];t.EventHandler.add(d,"scroll",this.scrollHandler,this)}}}t.Browser.isDevice||(this.delegateMoverHandler=this.moverHandler.bind(this),this.delegateMouseDownHandler=this.mouseDownHandler.bind(this),t.EventHandler.add(this.isMenu?document:e,"mouseover",this.delegateMoverHandler,this),t.EventHandler.add(document,"mousedown",this.delegateMouseDownHandler,this),t.EventHandler.add(document,"keydown",this.domKeyHandler,this),this.isMenu||this.target||t.EventHandler.add(document,"scroll",this.scrollHandler,this)),this.delegateClickHandler=this.clickHandler.bind(this),t.EventHandler.add(document,"click",this.delegateClickHandler,this),this.wireKeyboardEvent(e),this.rippleFn=t.rippleEffect(e,{selector:"."+S}),!this.isMenu&&this.enableScrolling&&(this.enableTouchScroll(e),document.addEventListener("touchstart",this.touchOutsideHandler.bind(this),{passive:!0}))},n.prototype.wireKeyboardEvent=function(e){var i={downarrow:"downarrow",uparrow:"uparrow",enter:"enter",leftarrow:"leftarrow",rightarrow:"rightarrow",escape:"escape"};this.isMenu&&(i.home="home",i.end="end",i.tab="tab"),new t.KeyboardEvents(e,{keyAction:this.keyBoardHandler.bind(this),keyConfigs:i})},n.prototype.mouseDownHandler=function(e){t.closest(e.target,".e-"+this.getModuleName()+"-wrapper")===this.getWrapper()||t.closest(e.target,".e-"+this.getModuleName()+"-popup")||this.closeMenu(this.isMenu?null:this.navIdx.length,e)},n.prototype.keyHandler=function(e){38!==e.keyCode&&40!==e.keyCode||e.target&&(e.target.classList.contains("e-contextmenu")||e.target.classList.contains("e-menu-item"))&&e.preventDefault()},n.prototype.domKeyHandler=function(e){27===e.keyCode&&(this.isMenuVisible()&&e.stopImmediatePropagation(),e.action="escape",this.leftEscKeyHandler(e))},n.prototype.keyBoardHandler=function(e){var i="",s=e.target,n=this.isMenu&&!this.hamburgerMode&&!this.element.classList.contains("e-vertical")&&this.navIdx.length<1;if(e.preventDefault(),this.enableScrolling&&13===e.keyCode&&s.classList.contains("e-scroll-nav")&&this.removeLIStateByClass([y,C],[t.closest(s,".e-"+this.getModuleName()+"-wrapper")]),this.isKBDAction=!0,n)switch(e.action){case"rightarrow":i="rightarrow",e.action="downarrow";break;case"leftarrow":i="leftarrow",e.action="uparrow";break;case"downarrow":i="downarrow",e.action="rightarrow";break;case"uparrow":i="uparrow",e.action=""}else if(this.enableRtl)switch(e.action){case"leftarrow":n=!0,i="leftarrow",e.action="rightarrow";break;case"rightarrow":n=!0,i="rightarrow",e.action="leftarrow"}switch(e.action){case"downarrow":case"uparrow":case"end":case"home":case"tab":this.upDownKeyHandler(e);break;case"rightarrow":this.rightEnterKeyHandler(e);break;case"leftarrow":this.leftEscKeyHandler(e);break;case"enter":this.hamburgerMode&&"SPAN"===s.tagName&&s.classList.contains("e-menu-icon")?this.menuHeaderClickHandler(e):this.rightEnterKeyHandler(e)}this.isAnimationNone&&(this.isKBDAction=!1),n&&(e.action=i)},n.prototype.upDownKeyHandler=function(e){var t=this.getUlByNavIdx(),i="downarrow"===e.action||"home"===e.action||"tab"===e.action?0:t.childElementCount-1,s=i,n=this.getLIByClass(t,y);n&&("end"!==e.action&&"home"!==e.action&&(s=this.getIdx(t,n)),n.classList.remove(y),"end"!==e.action&&"home"!==e.action&&("downarrow"===e.action?s++:s--,s===("downarrow"===e.action?t.childElementCount:-1)&&(s=i)));var r=t.children[s];s=this.isValidLI(r,s,e.action),t.children[s].classList.add(y),t.children[s].focus()},n.prototype.isValidLI=function(e,t,i){var s=this.getUlByNavIdx(),n="downarrow"===i||"home"===i||"tab"===i?0:s.childElementCount-1;return(e.classList.contains("e-separator")||e.classList.contains("e-disabled")||e.classList.contains(I))&&("downarrow"===i&&t===s.childElementCount-1?t=n:"uparrow"===i&&0===t?t=n:"downarrow"===i||"rightarrow"===i?t++:"tab"===i&&e.classList.contains("e-separator")?t++:t--),(e=s.children[t])&&(e.classList.contains("e-separator")||e.classList.contains("e-disabled")||e.classList.contains(I))&&(t=this.isValidLI(e,t,i)),t},n.prototype.getUlByNavIdx=function(e){var i=this;if(void 0===e&&(e=this.navIdx.length),this.isMenu){var s=[this.getWrapper()].concat([].slice.call(t.selectAll("."+x)))[e],n=[];return t.selectAll("."+x).forEach(function(e){(i.element.id===e.id.split("-")[2]||e.id.split("-")[2]+"-"+e.id.split("-")[3])&&n.push(e)}),s=[this.getWrapper()].concat([].slice.call(n))[e],t.isNullOrUndefined(s)?null:t.select(".e-menu-parent",s)}return document.body.contains(this.element)||0!==e?this.getWrapper().children[e]:null},n.prototype.rightEnterKeyHandler=function(e){var t,i=this.getUlByNavIdx(),s=this.getLIByClass(i,y);if(s){var n=this.getIdx(i,s),r=this.navIdx.concat(n),a=this.getItem(r);if(a.items.length)this.navIdx.push(n),this.keyType="right",this.action=e.action,this.openMenu(s,a,-1,-1,e);else if("enter"===e.action){this.isMenu&&0===this.navIdx.length?this.removeLIStateByClass([C],[this.getWrapper()]):s.classList.remove(y),s.classList.add(C),t={element:s,item:a,event:e},this.trigger("select",t);var o=s.querySelector(".e-menu-url");if(a.url&&o)switch(o.getAttribute("target")){case"_blank":window.open(a.url,"_blank");break;case"_parent":window.parent.location.href=a.url;break;default:window.location.href=a.url}this.closeMenu(null,e);var l=this.getLIByClass(this.getUlByNavIdx(),C);l&&(l.classList.add(y),l.focus())}}},n.prototype.leftEscKeyHandler=function(e){this.navIdx.length?(this.keyType="left",this.closeMenu(this.navIdx.length,e)):"escape"===e.action&&this.closeMenu(null,e)},n.prototype.scrollHandler=function(e){this.closeMenu(null,e)},n.prototype.touchHandler=function(e){this.isTapHold=!0,this.cmenuHandler(e.originalEvent)},n.prototype.cmenuHandler=function(e){e.preventDefault(),this.currentTarget=e.target,this.isCMenu=!0,this.pageX=e.changedTouches?e.changedTouches[0].pageX+1:e.pageX+1,this.pageY=e.changedTouches?e.changedTouches[0].pageY+1:e.pageY+1,this.closeMenu(null,e),this.isCMenu&&(this.canOpen(e.target)&&this.openMenu(null,null,this.pageY,this.pageX,e),this.isCMenu=!1)},n.prototype.closeMenu=function(e,i,n){var r=this;if(void 0===e&&(e=0),void 0===i&&(i=null),this.isMenuVisible()){var a,o,l=void 0,h=this.getWrapper(),c=void 0,p=this.getPopups(),u=!1,f=this.isMenu?p.length+1:h.childElementCount,g=this.isMenu&&1!==f?t.select(".e-ul",p[f-2]):t.selectAll(".e-menu-parent",h)[f-1];if(this.isMenu&&g.classList.contains("e-menu")&&((l=this.getLIByClass(g,C))&&l.classList.remove(C),u=!0),!u){var v=i&&i.target&&this.getLI(i.target);this.cli=v||g.children[0],a=this.navIdx.length?this.getItem(this.navIdx):null,o=a?a.items:this.items,c={element:g,parentItem:a,items:o,event:i,cancel:!1,isFocused:!0},this.trigger("beforeClose",c,function(l){var c,p,u,f="",b=!l.cancel;(b||r.isCMenu)&&(r.isMenu?(c=t.closest(g,"."+x),r.hamburgerMode&&(c.parentElement.style.minHeight="",t.closest(g,".e-menu-item").setAttribute("aria-expanded","false")),r.unWireKeyboardEvent(c),d(t.getInstance(c.children[0],m),c.children[0]),(u=t.getInstance(c,s.Popup)).hide(),f=c.id,u.destroy(),t.detach(c)):(r.isContextMenuClosed=!1,r.toggleAnimation(g,!1)),p={element:g,parentItem:a,items:o},r.trigger("onClose",p),r.navIdx.pop(),0===r.navIdx.length&&i&&"keyup"===i.type&&(r.showSubMenu=!1),r.isMenu||(t.EventHandler.remove(g,"keydown",r.keyHandler),"right"===r.keyType&&(r.keyType=""))),r.updateReactTemplate();var S,I,E,N=r.getWrapper()&&r.getUlByNavIdx();r.isCMenu&&(r.canOpen(i.target)&&r.openMenu(null,null,r.pageY,r.pageX,i),r.isCMenu=!1),r.isMenu&&N&&f.length?(S=new RegExp("(.*)-ej2menu-"+r.element.id+"-popup").exec(f)[1],I=N.querySelector('[id="'+S+'"]'),E=v&&N.querySelector('[id="'+v.id+'"]')):N&&(I=N.querySelector(".e-menu-item.e-selected"),E=v&&N.querySelector('[id="'+v.id+'"]'));var O=v&&v.querySelectorAll(".e-menu-item");if(b&&r.hamburgerMode&&e&&!O.length)r.afterCloseMenu(i);else if(b&&!r.hamburgerMode&&I&&!E&&"left"!==r.keyType&&(r.navIdx.length||!r.isMenu&&0===r.navIdx.length)){var w=i&&i.target.classList&&(i.target.classList.contains("e-vscroll")||i.target.classList.contains("e-scroll-nav"))?t.closest(i.target,".e-menu-wrapper"):null;w?(w=w.querySelector(".e-menu-item"),(r.showItemOnClick||w&&r.getIndex(w.id,!0).length<=r.navIdx.length)&&r.closeMenu(r.navIdx[r.navIdx.length-1],i,!0)):i&&i.target.classList&&i.target.classList.contains("e-nav-arrow")||r.closeMenu(r.navIdx[r.navIdx.length-1],i)}else if(b&&!n&&!e&&(r.hamburgerMode&&r.navIdx.length||1===r.navIdx.length&&v&&N!==v.parentElement))r.closeMenu(null,i);else if(b&&t.isNullOrUndefined(e)&&r.navIdx.length)r.closeMenu(null,i);else if(!b||r.isMenu||e||0!==r.navIdx.length||r.isMenusClosed||r.isCmenuHover)if(b&&r.isMenu&&i&&i.target&&0!==r.navIdx.length&&t.closest(i.target,".e-menu-parent.e-control"))r.closeMenu(0,i);else if(b&&!r.isMenu&&t.selectAll(".e-menu-parent",h)[e-1]&&3===i.which)r.closeMenu(null,i);else{if(!b||"right"!==r.keyType&&"click"!==r.keyType){var L=r.getUlByNavIdx(),k=r.getLIByClass(L,C);if(k&&(k.setAttribute("aria-expanded","false"),k.classList.remove(C),(l.isFocused&&v||"left"===r.keyType)&&(k.classList.add(y),i.target&&i.target.classList.contains("e-edit-template")||k.focus())),!b&&r.hamburgerMode&&v&&"false"===v.getAttribute("aria-expanded")&&"true"===v.getAttribute("aria-haspopup")){t.closest(v,".e-menu-parent.e-control")?r.navIdx=[]:r.navIdx.pop(),r.navIdx.push(r.cliIdx);var A=r.getItem(r.navIdx);v.setAttribute("aria-expanded","true"),r.openMenu(v,A,-1,-1,i)}}else r.afterCloseMenu(i);r.navIdx.length<1&&("Hover"!==r.showSubMenuOn&&"Click"!==r.showSubMenuOn||(r.showItemOnClick=r.defaultOption,r.showSubMenuOn="Auto"))}else r.isMenusClosed=!0,r.closeMenu(0,i);r.removeStateWrapper()})}}},n.prototype.updateReactTemplate=function(){if(this.isReact&&this.template&&0===this.navIdx.length){var e=void 0;this.portals&&(e=this.portals.splice(0,this.items.length)),this.clearTemplate(["template"]),this.portals=e,this.renderReactTemplates()}},n.prototype.getMenuItemModel=function(e,i){if(t.isNullOrUndefined(e))return null;t.isNullOrUndefined(i)&&(i=0);var s=this.getFields(i);return{text:e[s.text],id:e[s.id],items:e[s.child],separator:e[s.separator],iconCss:e[s.iconCss],url:e[s.url]}},n.prototype.getPopups=function(){var e=this,i=[];return[].slice.call(document.querySelectorAll("."+x)).forEach(function(s){!t.isNullOrUndefined(s.querySelector("."+S))&&e.getIndex(s.querySelector("."+S).id,!0).length&&i.push(s)}),i},n.prototype.isMenuVisible=function(){return this.navIdx.length>0||this.element.classList.contains("e-contextmenu")&&t.isVisible(this.element).valueOf()},n.prototype.canOpen=function(e){var i=!0;if(this.filter){i=!1;for(var s=this.filter.split(" "),n=0,r=s.length;n<r;n++)if(t.closest(e,"."+s[n])){i=!0;break}}return i},n.prototype.openMenu=function(e,i,n,r,a,o){var l=this;void 0===n&&(n=0),void 0===r&&(r=0),void 0===a&&(a=null),void 0===o&&(o=this.targetElement);var d=this.getWrapper();this.lItem=e;var h=""!==this.element.id?this.element.id:"menu";if(this.isMenusClosed=!1,t.isNullOrUndefined(n)&&(n=-1),t.isNullOrUndefined(r)&&(r=-1),e){if(this.uList=this.createItems(i[this.getField("children",this.navIdx.length-1)]),!this.isMenu&&t.Browser.isDevice){d.lastChild.style.display="none";var c={text:i[this.getField("text")].toString(),iconCss:"e-icons e-previous"};this.template&&(i.iconCss=(i.iconCss||"")+"e-icons e-previous");var p=new N(this.items[0],"items",this.template?i:c,!0),u=this.createItems([p]).children[0];u.classList.add(b),this.uList.insertBefore(u,this.uList.children[0])}this.isMenu?(this.popupWrapper=this.createElement("div",{className:"e-"+this.getModuleName()+"-wrapper "+x,id:e.id+"-ej2menu-"+h+"-popup"}),this.popupWrapper.setAttribute("role","navigation"),this.popupWrapper.setAttribute("aria-label",i.text+"-menu-popup"),this.hamburgerMode?(n=e.offsetHeight,e.appendChild(this.popupWrapper)):document.body.appendChild(this.popupWrapper),this.isNestedOrVertical=this.element.classList.contains("e-vertical")||1!==this.navIdx.length,this.popupObj=this.generatePopup(this.popupWrapper,this.uList,e,this.isNestedOrVertical),this.template&&this.renderReactTemplates(),this.hamburgerMode?this.calculateIndentSize(this.uList,e):(this.cssClass&&t.addClass([this.popupWrapper],this.cssClass.replace(/\s+/g," ").trim().split(" ")),this.popupObj.hide()),this.hamburgerMode||this.showItemOnClick||!this.hoverDelay?this.triggerBeforeOpen(e,this.uList,i,a,0,0,"menu"):(window.clearInterval(this.timer),this.timer=window.setTimeout(function(){l.triggerBeforeOpen(e,l.uList,i,a,0,0,"menu")},this.hoverDelay))):(this.uList.style.zIndex=this.element.style.zIndex,d.appendChild(this.uList),!this.showItemOnClick&&this.hoverDelay?(window.clearInterval(this.timer),this.timer=window.setTimeout(function(){l.triggerBeforeOpen(e,l.uList,i,a,n,r,"none")},this.hoverDelay)):this.triggerBeforeOpen(e,this.uList,i,a,n,r,"none"))}else if(this.uList=this.element,this.uList.style.zIndex=s.getZindexPartial(o||this.element).toString(),t.isNullOrUndefined(a)){var f=document.createEvent("MouseEvents");f.initEvent("click",!0,!1);var m=this.copyObject(f,{});m.target=m.srcElement=o,m.currentTarget=o,this.triggerBeforeOpen(e,this.uList,i,m,n,r,"none")}else this.triggerBeforeOpen(e,this.uList,i,a,n,r,"none")},n.prototype.copyObject=function(e,t){for(var i in e)t[""+i]=e[""+i];return t},n.prototype.calculateIndentSize=function(e,t){var i=getComputedStyle(t),s=parseInt(i.textIndent,10);this.navIdx.length<2&&!t.classList.contains("e-blankicon")?s*=2:s+=s/4,e.style.textIndent=s+"px";var n=e.querySelectorAll(".e-blankicon");if(n&&n.length)for(var r=e.querySelector(".e-menu-icon"),a=getComputedStyle(r),o=parseInt(a.marginRight,10)+r.offsetWidth+s,l=0;l<n.length;l++)n[l].style.textIndent=o+"px"},n.prototype.generatePopup=function(e,i,n,r){var a=this,o=new s.Popup(e,{actionOnScroll:this.hamburgerMode?"none":"reposition",relateTo:n,collision:this.hamburgerMode?{X:"none",Y:"none"}:{X:r||this.enableRtl?"none":"flip",Y:"fit"},position:r&&!this.hamburgerMode?{X:"right",Y:"top"}:{X:"left",Y:"bottom"},targetType:"relative",enableRtl:this.enableRtl,content:i,open:function(){var e=t.select(".e-menu-vscroll",o.element);e&&(e.style.height="inherit",e.style.maxHeight="");var i=t.select(".e-ul",o.element);o.element.style.maxHeight="",i.focus(),a.triggerOpen(i)}});return o},n.prototype.createHeaderContainer=function(e){e=e||this.getWrapper();var i=this.createElement("span",{className:"e-"+this.getModuleName()+"-header"}),s=this.enableHtmlSanitizer?t.SanitizeHtmlHelper.sanitize(this.title):this.title,n=this.createElement("span",{className:"e-"+this.getModuleName()+"-title",innerHTML:s}),r=this.createElement("span",{className:"e-icons e-"+this.getModuleName()+"-icon",attrs:{tabindex:"0"}});i.appendChild(n),i.appendChild(r),e.insertBefore(i,this.element)},n.prototype.openHamburgerMenu=function(e){this.hamburgerMode&&this.triggerBeforeOpen(null,this.element,null,e,0,0,"hamburger")},n.prototype.closeHamburgerMenu=function(e){var t=this,i={element:this.element,parentItem:null,event:e,items:this.items,cancel:!1};this.trigger("beforeClose",i,function(i){i.cancel||(t.closeMenu(null,e),t.element.classList.add("e-hide-menu"),t.trigger("onClose",{element:t.element,parentItem:null,items:t.items}))})},n.prototype.callFit=function(e,t,i,n,r){return s.fit(e,null,{X:t,Y:i},{top:n,left:r})},n.prototype.triggerBeforeOpen=function(e,i,s,n,r,a,l){var d,h=this,c=e?s[this.getField("children",this.navIdx.length-1)]:this.items,p={element:i,items:c,parentItem:s,event:n,cancel:!1,top:r,left:a,showSubMenuOn:"Auto"},u=l;this.trigger("beforeOpen",p,function(r){switch(u){case"menu":h.hamburgerMode||("Auto"!==r.showSubMenuOn&&(h.showItemOnClick=!h.defaultOption,h.showSubMenuOn=r.showSubMenuOn),h.top=r.top,h.left=r.left),h.popupWrapper.style.display="block",h.hamburgerMode||(h.popupWrapper.style.maxHeight=h.popupWrapper.getBoundingClientRect().height+"px",h.enableScrolling&&o(h.createElement,h.popupWrapper,h.uList,"vscroll",h.enableRtl),h.checkScrollOffset(n)),h.hamburgerMode||h.left||h.top?(h.popupObj.collision={X:"none",Y:"none"},h.popupWrapper.style.display=""):(h.popupObj.refreshPosition(h.lItem,!0),h.left=parseInt(h.popupWrapper.style.left,10),h.top=parseInt(h.popupWrapper.style.top,10),h.enableRtl&&(h.left=h.isNestedOrVertical?h.left-h.popupWrapper.offsetWidth-h.lItem.parentElement.offsetWidth+2:h.left-h.popupWrapper.offsetWidth+h.lItem.offsetWidth),h.template&&(h.isReact||h.isAngular)?requestAnimationFrame(function(){h.collision(),h.popupWrapper.style.display=""}):(h.collision(),h.popupWrapper.style.display=""));break;case"none":h.top=r.top,h.left=r.left,h.isContextMenuClosed=!0,d=r.element,h.enableScrolling&&h.isCMenu&&d&&d.parentElement&&(d.style.height=d.parentElement.style.height);break;case"hamburger":r.cancel||(h.element.classList.remove("e-hide-menu"),h.triggerOpen(h.element))}if("hamburger"!==u)if(r.cancel)h.isMenu?(h.popupObj.destroy(),t.detach(h.popupWrapper)):i.className.indexOf("e-ul")>-1&&t.detach(i),h.navIdx.pop();else if(h.isMenu)if(h.hamburgerMode)h.popupWrapper.style.top=h.top+"px",h.popupWrapper.style.left="0px",h.toggleAnimation(h.popupWrapper);else{h.setBlankIconStyle(h.popupWrapper),h.wireKeyboardEvent(h.popupWrapper),t.rippleEffect(h.popupWrapper,{selector:"."+S}),h.popupWrapper.style.left=h.left+"px",h.popupWrapper.style.top=h.top+"px";var a="None"!==h.animationSettings.effect?{name:h.animationSettings.effect,duration:h.animationSettings.duration,timingFunction:h.animationSettings.easing}:null;h.popupObj.show(a,h.lItem),t.Browser.isDevice&&(h.popupWrapper.style.left=h.left+"px")}else h.setBlankIconStyle(h.uList),h.setPosition(h.lItem,h.uList,h.top,h.left),h.toggleAnimation(h.uList);if("right"===h.keyType){var l=h.getUlByNavIdx();if(e.classList.remove(y),h.isMenu&&1===h.navIdx.length&&h.removeLIStateByClass([C],[h.getWrapper()]),e.classList.add(C),"enter"===h.action){var c={element:e,item:s,event:n};h.trigger("select",c)}e.focus(),l=h.getUlByNavIdx();var p=h.isValidLI(l.children[0],0,h.action);l.children[p].classList.add(y),l.children[p].focus()}})},n.prototype.collision=function(){var e;if(e=s.isCollide(this.popupWrapper,null,this.left,this.top),(this.isNestedOrVertical||this.enableRtl)&&(e.indexOf("right")>-1||e.indexOf("left")>-1)){this.popupObj.collision.X="none";var i=t.closest(this.lItem,".e-"+this.getModuleName()+"-wrapper").offsetWidth;this.left=this.enableRtl?s.calculatePosition(this.lItem,this.isNestedOrVertical?"right":"left","top").left:this.left-this.popupWrapper.offsetWidth-i+2}((e=s.isCollide(this.popupWrapper,null,this.left,this.top)).indexOf("left")>-1||e.indexOf("right")>-1)&&(this.left=this.callFit(this.popupWrapper,!0,!1,this.top,this.left).left),this.popupWrapper.style.left=this.left+"px"},n.prototype.setBlankIconStyle=function(e){var t=[].slice.call(e.getElementsByClassName("e-blankicon"));if(t.length){var i=e.querySelector(".e-menu-item:not(.e-blankicon):not(.e-separator)");if(i){var s=i.querySelector(".e-menu-icon");if(s){var n=this.enableRtl?{padding:"paddingRight",margin:"marginLeft"}:{padding:"paddingLeft",margin:"marginRight"},r=getComputedStyle(s),a=parseInt(r.fontSize,10);parseInt(r.width,10)&&parseInt(r.width,10)>a&&(a=parseInt(r.width,10));var o=a+parseInt(r[n.margin],10)+parseInt(getComputedStyle(i)[n.padding],10)+"px";t.forEach(function(e){e.style[n.padding]=o})}}}},n.prototype.checkScrollOffset=function(e){var i=this.getWrapper();if(i.children[0].classList.contains("e-menu-hscroll")&&1===this.navIdx.length){var s=t.isNullOrUndefined(e)?this.element:t.closest(e.target,"."+S),n=t.select(".e-hscroll-bar",i);n.scrollLeft>s.offsetLeft&&(n.scrollLeft-=n.scrollLeft-s.offsetLeft);var r=n.scrollLeft+n.offsetWidth,a=s.offsetLeft+s.offsetWidth;r<a&&(n.scrollLeft+=a-r)}},n.prototype.setPosition=function(e,i,n,r,a){void 0===a&&(a=!1);if(this.toggleVisiblity(i),i===this.element||r>-1&&n>-1){if((u=s.isCollide(i,null,r,n)).indexOf("right")>-1&&(r-=i.offsetWidth),u.indexOf("bottom")>-1&&(n=(p=this.callFit(i,!1,!0,n,r)).top-20)<0){var l=pageYOffset+document.documentElement.clientHeight-i.getBoundingClientRect().height;l>-1&&(n=l)}(u=s.isCollide(i,null,r,n)).indexOf("left")>-1&&(r=(p=this.callFit(i,!0,!1,n,r)).left)}else if(t.Browser.isDevice)if(!this.isMenu&&this.enableScrolling){var h=document.querySelector(".e-menu-vscroll");n=Number(h.style.top.replace("px","")),r=Number(h.style.left.replace("px",""))}else n=Number(this.element.style.top.replace("px","")),r=Number(this.element.style.left.replace("px",""));else{var c=this.enableRtl?"left":"right",p=s.calculatePosition(e,c,"top");n=p.top,r=p.left;var u=s.isCollide(i,null,this.enableRtl?r-i.offsetWidth:r,n),f=u.indexOf("left")>-1||u.indexOf("right")>-1;f&&(r=(p=s.calculatePosition(e,this.enableRtl?"right":"left","top")).left),(this.enableRtl||f)&&(r=this.enableRtl&&f?r:r-i.offsetWidth),u.indexOf("bottom")>-1&&(this.isMenu||!this.enableScrolling)&&(n=(p=this.callFit(i,!1,!0,n,r)).top)}this.toggleVisiblity(i,!1),this.isCMenu&&this.enableScrolling&&i&&(i.style.height="",i.style.top="",i.style.left="",i.style.width="",i.style.position="");var g=t.closest(this.element,".e-"+this.getModuleName()+"-wrapper");if(!this.isMenu&&this.enableScrolling&&i&&g&&g.offsetHeight>0){var v=t.closest(i,".e-menu-vscroll");i.style.display="block",v&&d(t.getInstance(v,m),v);var y=Math.ceil(this.getMenuWidth(i,i.offsetWidth,this.enableRtl)),b=o(this.createElement,g,i,"vscroll",this.enableRtl,g.offsetHeight);n=this.callFit(b,!1,!0,n,r).top,Object.assign(b.style,{top:n+"px",left:r+"px",width:y+"px",position:"absolute",display:a?"block":"none"})}else i.style.top=n+"px",i.style.left=r+"px"},n.prototype.getMenuWidth=function(e,t,i){var s=e.getElementsByClassName("e-caret")[0];return s&&(t+=parseInt(getComputedStyle(s)[i?"marginRight":"marginLeft"],10)),t<120?120:t},n.prototype.toggleVisiblity=function(e,t){void 0===t&&(t=!0),e.style.visibility=t?"hidden":"",e.style.display=t?"block":"none"},n.prototype.createItems=function(e){var s=this,n=this.navIdx?this.navIdx.length:0,r=this.getFields(n),a=this.hasField(e,this.getField("iconCss",n)),o={showIcon:a,moduleName:"menu",fields:r,template:this.template,itemNavigable:!0,itemCreating:function(e){e.curData[e.fields[r.id]]||(e.curData[e.fields[r.id]]=t.getUniqueID("menuitem")),t.isNullOrUndefined(e.curData.htmlAttributes)&&Object.defineProperty(e.curData,"htmlAttributes",{value:{},writable:!0,enumerable:!0,configurable:!0}),t.Browser.isIE?(e.curData.htmlAttributes.role||(e.curData.htmlAttributes.role="menuitem"),e.curData.htmlAttributes.tabindex||(e.curData.htmlAttributes.tabindex="-1")):Object.assign(e.curData.htmlAttributes,{role:e.curData.htmlAttributes.role||"menuitem",tabindex:e.curData.htmlAttributes.tabindex||"-1"}),s.isMenu&&!e.curData[s.getField("separator",n)]&&(e.curData.htmlAttributes["aria-label"]||(e.curData.htmlAttributes["aria-label"]=e.curData[e.fields.text]?e.curData[e.fields.text]:e.curData[e.fields.id])),""===e.curData[e.fields[r.iconCss]]&&(e.curData[e.fields[r.iconCss]]=null)},itemCreated:function(e){if(e.curData[s.getField("separator",n)]&&(e.item.classList.add("e-separator"),e.curData.htmlAttributes.role||e.item.setAttribute("role","separator"),e.curData.htmlAttributes.ariaLabel||e.item.setAttribute("aria-label","separator")),!a||e.curData[e.fields.iconCss]||e.curData[s.getField("separator",n)]||e.item.classList.add("e-blankicon"),e.curData[e.fields.child]&&e.curData[e.fields.child].length){var t=s.createElement("span",{className:"e-icons e-caret"});e.item.appendChild(t),e.item.setAttribute("aria-haspopup","true"),e.item.setAttribute("aria-expanded","false"),e.item.classList.add("e-menu-caret-icon")}s.template&&(e.item.setAttribute("id",e.curData[e.fields.id].toString()),e.item.removeAttribute("data-uid"),e.item.classList.contains("e-level-1")&&e.item.classList.remove("e-level-1"),e.item.classList.contains("e-has-child")&&e.item.classList.remove("e-has-child"),e.item.removeAttribute("aria-level"));var i={item:e.curData,element:e.item};s.trigger("beforeItemRender",i)}};this.setProperties({items:this.items},!0),this.isMenu&&(o.templateID=this.element.id+"Template");var l=i.ListBase.createList(this.createElement,e,o,!this.template,this);return l.setAttribute("tabindex","0"),this.isMenu?l.setAttribute("role","menu"):l.setAttribute("role","menubar"),l},n.prototype.moverHandler=function(e){var i=e.target;this.liTrgt=i,this.isMenu||(this.isCmenuHover=!0);var s=this.getLI(i),n=s?t.closest(s,".e-"+this.getModuleName()+"-wrapper"):this.getWrapper(),r=this.getWrapper(),a=new RegExp("-ej2menu-(.*)-popup"),o=!1;if(n){if((""!==n.id?a.exec(n.id)[1]:n.querySelector("ul").id)!==this.element.id){if(this.removeLIStateByClass([