2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
|
this.primereact=this.primereact||{},this.primereact.contextmenu=function(e,t,n,i,r,o,s){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=u(t),a=u(s);function c(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 d(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){return p=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},p(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&&p(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 d(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 C=function(e){h(o,e);var t=k(o);function o(e){var n;return c(this,o),(n=t.call(this,e)).state={activeItem:null},n.onEnter=n.onEnter.bind(d(n)),n.submenuRef=l.default.createRef(),n}return f(o,[{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.DomHandler.getOffset(this.submenuRef.current.parentElement),i=n.DomHandler.getViewport(),r=this.submenuRef.current.offsetParent?this.submenuRef.current.offsetWidth:n.DomHandler.getHiddenElementOuterWidth(this.submenuRef.current),o=n.DomHandler.getOuterWidth(e.children[0]);this.submenuRef.current.style.top="0px",this.submenuRef.current.style.left=parseInt(t.left,10)+o+r>i.width-n.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 l.default.createElement("li",{key:"separator_"+e,className:"p-menu-separator",role:"separator"})}},{key:"renderSubmenu",value:function(e){return e.items?l.default.createElement(o,{model:e.items,resetMenu:e!==this.state.activeItem,onLeafClick:this.props.onLeafClick}):null}},{key:"renderMenuitem",value:function(e,t){var i=this,o=this.state.activeItem===e,s=n.classNames("p-menuitem",{"p-menuitem-active":o},e.className),u=n.classNames("p-menuitem-link",{"p-disabled":e.disabled}),a=n.classNames("p-menuitem-icon",e.icon),c="p-submenu-icon pi pi-angle-right",m=e.icon&&l.default.createElement("span",{className:a}),f=e.label&&l.default.createElement("span",{className:"p-menuitem-text"},e.label),d=e.
|