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

2 lines
11 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 i,ObjectUtils as r,ZIndexUtils as o}from"primereact/utils";import{CSSTransition as s}from"primereact/csstransition";import{Ripple as u}from"primereact/ripple";import{Portal as c}from"primereact/portal";import l from"primereact/api";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(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 f(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function p(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 h(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 v(e){return v="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},v(e)}function b(e,t){if(t&&("object"===v(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return p(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function E(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function k(e){var t=L();return function(){var n,i=y(e);if(t){var r=y(this).constructor;n=Reflect.construct(i,arguments,r)}else n=i.apply(this,arguments);return b(this,n)}}function L(){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 R=function(o){h(l,t);var c=k(l);function l(t){var n;return a(this,l),(n=c.call(this,t)).state={activeItem:null},n.onEnter=n.onEnter.bind(p(n)),n.submenuRef=e.createRef(),n}return f(l,[{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,t=n.getOffset(this.submenuRef.current.parentElement),i=n.getViewport(),r=this.submenuRef.current.offsetParent?this.submenuRef.current.offsetWidth:n.getHiddenElementOuterWidth(this.submenuRef.current),o=n.getOuterWidth(e.children[0]);this.submenuRef.current.style.top="0px",this.submenuRef.current.style.left=parseInt(t.left,10)+o+r>i.width-n.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(t){return e.createElement("li",{key:"separator_"+t,className:"p-menu-separator",role:"separator"})}},{key:"renderSubmenu",value:function(t){return t.items?e.createElement(l,{model:t.items,resetMenu:t!==this.state.activeItem,onLeafClick:this.props.onLeafClick}):null}},{key:"renderMenuitem",value:function(t,n){var o=this,s=this.state.activeItem===t,c=i("p-menuitem",{"p-menuitem-active":s},t.className),l=i("p-menuitem-link",{"p-disabled":t.disabled}),a=i("p-menuitem-icon",t.icon),m="p-submenu-icon pi pi-angle-right",f=t.icon&&e.createElement("span",{className:a}),p=t.label&&e.createElement("span",{className:"p-menuitem-text"},t.label),d=t.items&&e.crea