katoikia-app/web-ui/web-react/node_modules/primereact/megamenu/megamenu.esm.min.js

2 lines
8.6 KiB
JavaScript
Raw Normal View History

2022-07-06 04:15:11 +00:00
import e,{Component as t}from"react";import{DomHandler as n,classNames as r,ObjectUtils as a}from"primereact/utils";import{Ripple as i}from"primereact/ripple";function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function p(e,t){if(t&&("object"===m(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return u(e)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function d(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}var v,h,y,b=function(s){c(g,t);var m,v,h,y,b,k=(m=g,v=d(),function(){var e,t=f(m);if(v){var n=f(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return p(this,e)});function g(e){var t;return l(this,g),(t=k.call(this,e)).state={activeItem:null},t.onLeafClick=t.onLeafClick.bind(u(t)),t}return h=g,(y=[{key:"onLeafClick",value:function(e,t){t.disabled?e.preventDefault():(t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t}),this.setState({activeItem:null}))}},{key:"onCategoryMouseEnter",value:function(e,t){t.disabled?e.preventDefault():this.state.activeItem&&this.setState({activeItem:t})}},{key:"onCategoryClick",value:function(e,t){t.disabled||(t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:this.props.item}),t.items&&this.setState(this.state.activeItem&&this.state.activeItem===t?{activeItem:null}:{activeItem:t})),e.preventDefault()}},{key:"onCategoryKeyDown",value:function(e,t){var n=e.currentTarget.parentElement;switch(e.which){case 40:this.isHorizontal()?this.expandMenu(t):this.navigateToNextItem(n),e.preventDefault();break;case 38:this.isVertical()?this.navigateToPrevItem(n):t.items&&t===this.state.activeItem&&this.collapseMenu(),e.preventDefault();break;case 39:this.isHorizontal()?this.navigateToNextItem(n):this.expandMenu(t),e.preventDefault();break;case 37:this.isHorizontal()?this.navigateToPrevItem(n):t.items&&t===this.state.activeItem&&this.collapseMenu(),e.preventDefault()}}},{key:"expandMenu",value:function(e){e.items&&this.setState({activeItem:e})}},{key:"collapseMenu",value:function(e){this.setState({activeItem:null})}},{key:"findNextItem",value:function(e){var t=e.nextElementSibling;return t?n.hasClass(t,"p-disabled")||!n.hasClass(t,"p-menuitem")?this.findNextItem(t):t:null}},{key:"findPrevItem",value:function(e){var t=e.previousElementSibling;return t?n.hasClass(t,"p-disabled")||!n.hasClass(t,"p-menuitem")?this.findPrevItem(t):t:null}},{key:"navigateToNextItem",value:function(e){var t=this.findNextItem(e);t&&t.children[0].focus()}},{key:"navigateToPrevItem",value:function(e){var t=this.findPrevItem(e);t&&t.children[0].focus()}},{key:"isHorizontal",value:function(){return"horizontal"===this.props.orientation}},{key:"isVertical",value:function(){return"vertical"===this.props.orientation}},{key:"getColumnClassName",value:function(e){var t;switch(e.items?e.items.leng