katoikia-app/web-ui/web-react/node_modules/primereact/contextmenu/contextmenu.cjs.min.js

2 lines
11 KiB
JavaScript
Raw Normal View History

2022-07-06 04:15:11 +00:00
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("primereact/utils"),n=require("primereact/csstransition"),i=require("primereact/ripple"),r=require("primereact/portal"),o=require("primereact/api");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=u(e),l=u(o);function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function m(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function d(e,t){return d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},d(e,t)}function p(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&&d(e,t)}function h(e){return h="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},h(e)}function v(e,t){if(t&&("object"===h(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return f(e)}function b(e){return b=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},b(e)}function y(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function E(e){var t=k();return function(){var n,i=b(e);if(t){var r=b(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return v(this,n)}}function k(){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 L=function(r){p(u,e.Component);var o=E(u);function u(e){var t;return a(this,u),(t=o.call(this,e)).state={activeItem:null},t.onEnter=t.onEnter.bind(f(t)),t.submenuRef=s.default.createRef(),t}return m(u,[{key:"onItemMouseEnter",value:function(e,t){t.disabled?e.preventDefault():this.setState({activeItem:t})}},{key:"onItemClick",value:function(e,t){t.disabled?e.preventDefault():(t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t}),t.items||this.props.onLeafClick(e))}},{key:"position",value:function(){var e=this.submenuRef.current.parentElement,n=t.DomHandler.getOffset(this.submenuRef.current.parentElement),i=t.DomHandler.getViewport(),r=this.submenuRef.current.offsetParent?this.submenuRef.current.offsetWidth:t.DomHandler.getHiddenElementOuterWidth(this.submenuRef.current),o=t.DomHandler.getOuterWidth(e.children[0]);this.submenuRef.current.style.top="0px",this.submenuRef.current.style.left=parseInt(n.left,10)+o+r>i.width-t.DomHandler.calculateScrollbarWidth()?-1*r+"px":o+"px"}},{key:"onEnter",value:function(){this.position()}},{key:"isActive",value:function(){return this.props.root||!this.props.resetMenu}},{key:"componentDidUpdate",value:function(){this.isActive()&&this.position()}},{key:"renderSeparator",value:function(e){return s.default.createElement("li",{key:"separator_"+e,className:"p-menu-separator",role:"separator"})}},{key:"renderSubmenu",value:function(e){return e.items?s.default.createElement(u,{model:e.items,resetMenu:e!==this.state.activeItem,onLeafClick:this.props.onLeafClick}):null}},{key:"renderMenuitem",value:function(e,n){var r=this,o=this.state.activeItem===e,u=t.classNames("p-menuitem",{"p-menuitem-active":o},e.className),l=t.classNames("p-menuitem-link",{"p-disabled":e.disabled}),a=t.classNames("p-menuitem-icon",e.icon),c="p-submenu-icon pi