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

2 lines
10 KiB
JavaScript

this.primereact=this.primereact||{},this.primereact.slidemenu=function(e,t,n,i,r,s,o){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=a(t),u=a(o);function c(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(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&&d(e.prototype,t),n&&d(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e,t){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(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&&f(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 c(e)}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function k(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=w();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 w(){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 g=function(e){h(i,e);var t=E(i);function i(e){var n;return p(this,i),(n=t.call(this,e)).state={activeItem:null},n}return m(i,[{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.setState({activeItem:t}),this.props.onForward()))}},{key:"renderSeparator",value:function(e){return l.default.createElement("li",{key:"separator_"+e,className:"p-menu-separator"})}},{key:"renderSubmenu",value:function(e){return e.items?l.default.createElement(i,{model:e.items,index:this.props.index+1,menuWidth:this.props.menuWidth,effectDuration:this.props.effectDuration,onForward:this.props.onForward,parentActive:e===this.state.activeItem}):null}},{key:"renderMenuitem",value:function(e,t){var i=this,r=this.state.activeItem===e,s=n.classNames("p-menuitem",{"p-menuitem-active":r,"p-disabled":e.disabled},e.className),o=n.classNames("p-menuitem-icon",e.icon),a="p-submenu-icon pi pi-fw pi-angle-right",u=e.icon&&l.default.createElement("span",{className:o}),c=e.label&&l.default.createElement("span",{className:"p-menuitem-text"},e.label),p=e.items&&l.default.createElement("span",{className:a}),d=this.renderSubmenu(e),m=l.default.createElement("a",{href:e.url||"#",className:"p-menuitem-link",target:e.target,onClick:function(n){return i.onItemClick(n,e,t)},"aria-disabled":e.disabled},u,c,p);e.template&&(m=n.ObjectUtils.getJSXElement(e.template,e,{onClick:function(n){return i.onItemClick(n,e,t)},className:"p-menuitem-link",labelClassName:"p-menuitem-text",iconClassName:o,submenuIconClassName:a,element:m,props:this.props,active:r}));return l.default.createElement("li",{key:e.label+"_"+t,className:s,style:e.style},m,d)}},{key:"renderItem",value:function(e,t){return e.separator?this.renderSeparator(t):this.renderMenuitem(e,t)}},{key:"renderItems",value:function(){var e=this;return this.props.model?this.props.model.map((function(t,n){return e.renderItem(t,n)})):null}},{key:"render",value:function(){var e=n.classNames({"p-slidemenu-rootlist":this.props.root,"p-submenu-list":!this.props.root,"p-active-submenu":this.props.parentActive}),t={width:this.props.menuWidth+"px",left:this.props.root?-1*this.props.level*this.props.menuWidth+"px":this.props.menuWidth+"px",transitionProperty:this.props.root?"left":"none",transitionDuration:this.props.effectDuration+"ms",transitionTimingFunction:this.props.easing},i=this.renderItems();return l.default.createElement("ul",{className:e,style:t},i)}}]),i}(t.Component);k(g,"defaultProps",{model:null,level:0,easing:"ease-out",effectDuration:250,menuWidth:190,parentActive:!1,onForward:null});var S=function(e){h(o,e);var t=E(o);function o(e){var n;return p(this,o),(n=t.call(this,e)).state={level:0,visible:!1},n.navigateBack=n.navigateBack.bind(c(n)),n.navigateForward=n.navigateForward.bind(c(n)),n.onEnter=n.onEnter.bind(c(n)),n.onEntered=n.onEntered.bind(c(n)),n.onExit=n.onExit.bind(c(n)),n.onExited=n.onExited.bind(c(n)),n.onPanelClick=n.onPanelClick.bind(c(n)),n.menuRef=l.default.createRef(),n}return m(o,[{key:"onPanelClick",value:function(e){this.props.popup&&r.OverlayService.emit("overlay-click",{originalEvent:e,target:this.target})}},{key:"navigateForward",value:function(){this.setState({level:this.state.level+1})}},{key:"navigateBack",value:function(){this.setState({level:this.state.level-1})}},{key:"renderBackward",value:function(){var e=this,t=n.classNames("p-slidemenu-backward",{"p-hidden":0===this.state.level});return l.default.createElement("div",{ref:function(t){return e.backward=t},className:t,onClick:this.navigateBack},l.default.createElement("span",{className:"p-slidemenu-backward-icon pi pi-fw pi-chevron-left"}),l.default.createElement("span",null,this.props.backLabel))}},{key:"toggle",value:function(e){this.props.popup&&(this.state.visible?this.hide(e):this.show(e))}},{key:"show",value:function(e){var t=this;this.target=e.currentTarget;var n=e;this.setState({visible:!0},(function(){t.props.onShow&&t.props.onShow(n)}))}},{key:"hide",value:function(e){var t=this,n=e;this.setState({visible:!1},(function(){t.props.onHide&&t.props.onHide(n)}))}},{key:"onEnter",value:function(){this.props.autoZIndex&&n.ZIndexUtils.set("menu",this.menuRef.current,u.default.autoZIndex,this.props.baseZIndex||u.default.zIndex.menu),n.DomHandler.absolutePosition(this.menuRef.current,this.target)}},{key:"onEntered",value:function(){this.bindDocumentClickListener(),this.bindDocumentResizeListener(),this.bindScrollListener()}},{key:"onExit",value:function(){this.target=null,this.unbindDocumentClickListener(),this.unbindDocumentResizeListener(),this.unbindScrollListener()}},{key:"onExited",value:function(){n.ZIndexUtils.clear(this.menuRef.current),this.setState({level:0})}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){e.state.visible&&e.isOutsideClicked(t)&&e.hide(t)},document.addEventListener("click",this.documentClickListener))}},{key:"isOutsideClicked",value:function(e){return this.menuRef&&this.menuRef.current&&!(this.menuRef.current.isSameNode(e.target)||this.menuRef.current.contains(e.target))}},{key:"bindDocumentResizeListener",value:function(){var e=this;this.documentResizeListener||(this.documentResizeListener=function(t){e.state.visible&&!n.DomHandler.isTouchDevice()&&e.hide(t)},window.addEventListener("resize",this.documentResizeListener))}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"unbindDocumentResizeListener",value:function(){this.documentResizeListener&&(window.removeEventListener("resize",this.documentResizeListener),this.documentResizeListener=null)}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new n.ConnectedOverlayScrollHandler(this.target,(function(t){e.state.visible&&e.hide(t)}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"componentDidUpdate",value:function(e,t){this.props.model!==e.model&&this.setState({level:0})}},{key:"componentWillUnmount",value:function(){this.unbindDocumentClickListener(),this.unbindDocumentResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),n.ZIndexUtils.clear(this.menuRef.current)}},{key:"renderElement",value:function(){var e=this,t=n.classNames("p-slidemenu p-component",{"p-slidemenu-overlay":this.props.popup},this.props.className),r=this.renderBackward();return l.default.createElement(i.CSSTransition,{nodeRef:this.menuRef,classNames:"p-connected-overlay",in:!this.props.popup||this.state.visible,timeout:{enter:120,exit:100},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.onEnter,onEntered:this.onEntered,onExit:this.onExit,onExited:this.onExited},l.default.createElement("div",{ref:this.menuRef,id:this.props.id,className:t,style:this.props.style,onClick:this.onPanelClick},l.default.createElement("div",{className:"p-slidemenu-wrapper",style:{height:this.props.viewportHeight+"px"}},l.default.createElement("div",{className:"p-slidemenu-content",ref:function(t){return e.slideMenuContent=t}},l.default.createElement(g,{model:this.props.model,root:!0,index:0,menuWidth:this.props.menuWidth,effectDuration:this.props.effectDuration,level:this.state.level,parentActive:0===this.state.level,onForward:this.navigateForward})),r)))}},{key:"render",value:function(){var e=this.renderElement();return this.props.popup?l.default.createElement(s.Portal,{element:e,appendTo:this.props.appendTo}):e}}]),o}(t.Component);return k(S,"defaultProps",{id:null,model:null,popup:!1,style:null,className:null,easing:"ease-out",effectDuration:250,backLabel:"Back",menuWidth:190,viewportHeight:175,autoZIndex:!0,baseZIndex:0,appendTo:null,transitionOptions:null,onShow:null,onHide:null}),e.SlideMenu=S,e.SlideMenuSub=g,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils,primereact.csstransition,primereact.overlayservice,primereact.portal,primereact.api);