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

2 lines
4.7 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/ripple");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=r(e);function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function l(e,t){return l=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},l(e,t)}function u(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&&l(e,t)}function c(e){return c="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},c(e)}function s(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(t&&("object"===c(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return s(e)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function m(){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 d,b,y,h=function(r){u(h,e.Component);var l,c,s,d,b,y=(l=h,c=m(),function(){var e,t=f(l);if(c){var n=f(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return p(this,e)});function h(e){var t;return i(this,h),(t=y.call(this,e)).props.onTabChange||(t.state={activeIndex:e.activeIndex}),t}return s=h,(d=[{key:"itemClick",value:function(e,t,n){t.disabled?e.preventDefault():(t.url||e.preventDefault(),t.command&&t.command({originalEvent:e,item:t}),this.props.onTabChange?this.props.onTabChange({originalEvent:e,value:t,index:n}):this.setState({activeIndex:n}))}},{key:"getActiveIndex",value:function(){return this.props.onTabChange?this.props.activeIndex:this.state.activeIndex}},{key:"isSelected",value:function(e){return e===(this.getActiveIndex()||0)}},{key:"updateInkBar",value:function(){var e=this.getActiveIndex(),n=this["tab_".concat(e)];this.inkbar.style.width=t.DomHandler.getWidth(n)+"px",this.inkbar.style.left=t.DomHandler.getOffset(n).left-t.DomHandler.getOffset(this.nav).left+"px"}},{key:"componentDidMount",value:function(){this.updateInkBar()}},{key:"componentDidUpdate",value:function(){this.updateInkBar()}},{key:"renderMenuItem",value:function(e,r){var i=this,o=this.isSelected(r),l=t.classNames("p-tabmenuitem",{"p-highlight":o,"p-disabled":e.disabled},e.className),u=t.classNames("p-menuitem-icon",e.icon),c=a.default.createElement("a",{href:e.url||"#",className:"p-menuitem-link",target:e.target,onClick:function(t){return i.itemClick(t,e,r)},role:"presentation"},e.icon&&a.default.createElement("span",{className:u}),e.label&&a.default.createElement("span",{className:"p-menuitem-text"},e.label),a.default.createElement(n.Ripple,null));return e.template&&(c=t.ObjectUtils.getJSXElement(e.template,e,{onClick:function(t){return i.itemClick(t,e)},className:"p-menuitem-link",labelClassName:"p-menuitem-text",iconClassName:u,element:c,props:this.props,active:o,index:r})),a.default.createElement("li",{ref:function(e){return i["tab_".concat(r)]=e},key:e.label+"_"+r,className:l,style:e.style,role:"tab","aria-selected":o,"aria-expanded":o,"aria-disabled":e.disabled},c)}},{key:"renderItems",value:function(){var e=this;return this.props.model.map((function(t,n){return e.renderMenuItem(t,n)}))}},{key:"render",value:function(){var e=this;if(this.props.model