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

2 lines
12 KiB
JavaScript

this.primereact=this.primereact||{},this.primereact.splitbutton=function(e,t,n,i,r,o,l,s,a){"use strict";function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var c=u(t),p=u(a);function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(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 h(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function m(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e,t){return y=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},y(e,t)}function v(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&&y(e,t)}function b(e){return b="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},b(e)}function k(e,t){if(t&&("object"===b(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return m(e)}function O(e){return O=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},O(e)}function C(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(){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 w=function(e){v(o,e);var t,n,r=(t=o,n=E(),function(){var e,i=O(t);if(n){var r=O(this).constructor;e=Reflect.construct(i,arguments,r)}else e=i.apply(this,arguments);return k(this,e)});function o(e){var t;return d(this,o),(t=r.call(this,e)).onClick=t.onClick.bind(m(t)),t}return h(o,[{key:"onClick",value:function(e){this.props.menuitem.command&&this.props.menuitem.command({originalEvent:e,item:this.props.menuitem}),this.props.onItemClick&&this.props.onItemClick(e),e.preventDefault()}},{key:"renderSeparator",value:function(){return c.default.createElement("li",{className:"p-menu-separator",role:"separator"})}},{key:"renderMenuitem",value:function(){var e=this,t=this.props.menuitem,n=t.icon,r=t.label,o=t.template,l=t.url,s=t.target,a=i.classNames("p-menuitem-link",{"p-disabled":t.disabled}),u=i.classNames("p-menuitem-icon",n),p=c.default.createElement("a",{href:l||"#",role:"menuitem",className:a,target:s,onClick:this.onClick},n=n&&c.default.createElement("span",{className:u}),r=r&&c.default.createElement("span",{className:"p-menuitem-text"},r));o&&(p=i.ObjectUtils.getJSXElement(o,this.props.menuitem,{onClick:function(t){return e.onClick(t)},className:a,labelClassName:"p-menuitem-text",iconClassName:u,element:p,props:this.props}));return c.default.createElement("li",{className:"p-menuitem",role:"none"},p)}},{key:"renderItem",value:function(){return this.props.menuitem.separator?this.renderSeparator():this.renderMenuitem()}},{key:"render",value:function(){return this.renderItem()}}]),o}(t.Component);function R(){return R=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},R.apply(this,arguments)}function S(){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}}C(w,"defaultProps",{menuitem:null,onItemClick:null});var L=function(e){v(s,e);var t,n,l=(t=s,n=S(),function(){var e,i=O(t);if(n){var r=O(this).constructor;e=Reflect.construct(i,arguments,r)}else e=i.apply(this,arguments);return k(this,e)});function s(){return d(this,s),l.apply(this,arguments)}return h(s,[{key:"renderElement",value:function(){var e=i.classNames("p-menu p-menu-overlay p-component",this.props.menuClassName);return c.default.createElement(r.CSSTransition,{nodeRef:this.props.forwardRef,classNames:"p-connected-overlay",in:this.props.in,timeout:{enter:120,exit:100},options:this.props.transitionOptions,unmountOnExit:!0,onEnter:this.props.onEnter,onEntered:this.props.onEntered,onExit:this.props.onExit,onExited:this.props.onExited},c.default.createElement("div",{ref:this.props.forwardRef,className:e,style:this.props.menuStyle,id:this.props.id,onClick:this.onClick},c.default.createElement("ul",{className:"p-menu-list p-reset",role:"menu"},this.props.children)))}},{key:"render",value:function(){var e=this.renderElement();return c.default.createElement(o.Portal,{element:e,appendTo:this.props.appendTo})}}]),s}(t.Component);C(L,"defaultProps",{appendTo:null,menuStyle:null,menuClassName:null,id:null,onClick:null});var x=c.default.forwardRef((function(e,t){return c.default.createElement(L,R({forwardRef:t},e))}));function N(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?N(Object(n),!0).forEach((function(t){C(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):N(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(){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){v(a,e);var t,r,o=(t=a,r=j(),function(){var e,n=O(t);if(r){var i=O(this).constructor;e=Reflect.construct(n,arguments,i)}else e=n.apply(this,arguments);return k(this,e)});function a(e){var t;return d(this,a),(t=o.call(this,e)).state={id:e.id,overlayVisible:!1},t.onDropdownButtonClick=t.onDropdownButtonClick.bind(m(t)),t.onItemClick=t.onItemClick.bind(m(t)),t.onOverlayEnter=t.onOverlayEnter.bind(m(t)),t.onOverlayEntered=t.onOverlayEntered.bind(m(t)),t.onOverlayExit=t.onOverlayExit.bind(m(t)),t.onOverlayExited=t.onOverlayExited.bind(m(t)),t.onPanelClick=t.onPanelClick.bind(m(t)),t.overlayRef=c.default.createRef(),t}return h(a,[{key:"onPanelClick",value:function(e){s.OverlayService.emit("overlay-click",{originalEvent:e,target:this.container})}},{key:"onDropdownButtonClick",value:function(){this.state.overlayVisible?this.hide():this.show()}},{key:"onItemClick",value:function(){this.hide()}},{key:"show",value:function(){this.setState({overlayVisible:!0})}},{key:"hide",value:function(){this.setState({overlayVisible:!1})}},{key:"onOverlayEnter",value:function(){i.ZIndexUtils.set("overlay",this.overlayRef.current,p.default.autoZIndex,p.default.zIndex.overlay),this.alignOverlay()}},{key:"onOverlayEntered",value:function(){this.bindDocumentClickListener(),this.bindScrollListener(),this.bindResizeListener(),this.props.onShow&&this.props.onShow()}},{key:"onOverlayExit",value:function(){this.unbindDocumentClickListener(),this.unbindScrollListener(),this.unbindResizeListener()}},{key:"onOverlayExited",value:function(){i.ZIndexUtils.clear(this.overlayRef.current),this.props.onHide&&this.props.onHide()}},{key:"alignOverlay",value:function(){i.DomHandler.alignOverlay(this.overlayRef.current,this.defaultButton.parentElement,this.props.appendTo||p.default.appendTo)}},{key:"bindDocumentClickListener",value:function(){var e=this;this.documentClickListener||(this.documentClickListener=function(t){e.state.overlayVisible&&e.isOutsideClicked(t)&&e.hide()},document.addEventListener("click",this.documentClickListener))}},{key:"bindScrollListener",value:function(){var e=this;this.scrollHandler||(this.scrollHandler=new i.ConnectedOverlayScrollHandler(this.container,(function(){e.state.overlayVisible&&e.hide()}))),this.scrollHandler.bindScrollListener()}},{key:"unbindScrollListener",value:function(){this.scrollHandler&&this.scrollHandler.unbindScrollListener()}},{key:"bindResizeListener",value:function(){var e=this;this.resizeListener||(this.resizeListener=function(){e.state.overlayVisible&&!i.DomHandler.isTouchDevice()&&e.hide()},window.addEventListener("resize",this.resizeListener))}},{key:"unbindResizeListener",value:function(){this.resizeListener&&(window.removeEventListener("resize",this.resizeListener),this.resizeListener=null)}},{key:"isOutsideClicked",value:function(e){return this.container&&this.overlayRef&&this.overlayRef.current&&!this.overlayRef.current.contains(e.target)}},{key:"unbindDocumentClickListener",value:function(){this.documentClickListener&&(document.removeEventListener("click",this.documentClickListener),this.documentClickListener=null)}},{key:"componentDidMount",value:function(){this.state.id||this.setState({id:i.UniqueComponentId()}),this.props.tooltip&&this.renderTooltip()}},{key:"componentDidUpdate",value:function(e){e.tooltip===this.props.tooltip&&e.tooltipOptions===this.props.tooltipOptions||(this.tooltip?this.tooltip.update(P({content:this.props.tooltip},this.props.tooltipOptions||{})):this.renderTooltip())}},{key:"componentWillUnmount",value:function(){this.unbindDocumentClickListener(),this.unbindResizeListener(),this.scrollHandler&&(this.scrollHandler.destroy(),this.scrollHandler=null),this.tooltip&&(this.tooltip.destroy(),this.tooltip=null),i.ZIndexUtils.clear(this.overlayRef.current)}},{key:"renderTooltip",value:function(){this.tooltip=l.tip({target:this.container,content:this.props.tooltip,options:this.props.tooltipOptions})}},{key:"renderItems",value:function(){var e=this;return this.props.model?this.props.model.map((function(t,n){return c.default.createElement(w,{menuitem:t,key:n,onItemClick:e.onItemClick})})):null}},{key:"render",value:function(){var e=this,t=i.classNames("p-splitbutton p-component",this.props.className,{"p-disabled":this.props.disabled}),r=i.classNames("p-splitbutton-defaultbutton",this.props.buttonClassName),o=i.classNames("p-splitbutton-menubutton",this.props.menuButtonClassName),l=this.renderItems(),s=this.props.buttonTemplate?i.ObjectUtils.getJSXElement(this.props.buttonTemplate,this.props):null;return c.default.createElement("div",{id:this.state.id,className:t,style:this.props.style,ref:function(t){return e.container=t}},c.default.createElement(n.Button,{ref:function(t){return e.defaultButton=t},type:"button",className:r,icon:this.props.icon,label:this.props.label,onClick:this.props.onClick,disabled:this.props.disabled,tabIndex:this.props.tabIndex},s),c.default.createElement(n.Button,{type:"button",className:o,icon:this.props.dropdownIcon,onClick:this.onDropdownButtonClick,disabled:this.props.disabled,"aria-expanded":this.state.overlayVisible,"aria-haspopup":!0,"aria-owns":this.state.id+"_overlay"}),c.default.createElement(x,{ref:this.overlayRef,appendTo:this.props.appendTo,id:this.state.id+"_overlay",menuStyle:this.props.menuStyle,menuClassName:this.props.menuClassName,onClick:this.onPanelClick,in:this.state.overlayVisible,onEnter:this.onOverlayEnter,onEntered:this.onOverlayEntered,onExit:this.onOverlayExit,onExited:this.onOverlayExited,transitionOptions:this.props.transitionOptions},l))}}]),a}(t.Component);return C(g,"defaultProps",{id:null,label:null,icon:null,model:null,disabled:null,style:null,className:null,buttonClassName:null,menuStyle:null,menuClassName:null,menuButtonClassName:null,tabIndex:null,appendTo:null,tooltip:null,tooltipOptions:null,buttonTemplate:null,transitionOptions:null,dropdownIcon:"pi pi-chevron-down",onClick:null,onShow:null,onHide:null}),e.SplitButton=g,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.button,primereact.utils,primereact.csstransition,primereact.portal,primereact.tooltip,primereact.overlayservice,primereact.api);