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

2 lines
4.7 KiB
JavaScript

this.primereact=this.primereact||{},this.primereact.tabmenu=function(e,t,n,r){"use strict";function a(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=a(t);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function l(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 u(e,t){return u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},u(e,t)}function c(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&&u(e,t)}function s(e){return s="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},s(e)}function p(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function f(e,t){if(t&&("object"===s(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 m(e){return m=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},m(e)}function d(){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 b,y,h,v=function(e){c(y,e);var t,a,u,s,p,b=(t=y,a=d(),function(){var e,n=m(t);if(a){var r=m(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return f(this,e)});function y(e){var t;return o(this,y),(t=b.call(this,e)).props.onTabChange||(t.state={activeIndex:e.activeIndex}),t}return u=y,(s=[{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(),t=this["tab_".concat(e)];this.inkbar.style.width=n.DomHandler.getWidth(t)+"px",this.inkbar.style.left=n.DomHandler.getOffset(t).left-n.DomHandler.getOffset(this.nav).left+"px"}},{key:"componentDidMount",value:function(){this.updateInkBar()}},{key:"componentDidUpdate",value:function(){this.updateInkBar()}},{key:"renderMenuItem",value:function(e,t){var a=this,o=this.isSelected(t),l=n.classNames("p-tabmenuitem",{"p-highlight":o,"p-disabled":e.disabled},e.className),u=n.classNames("p-menuitem-icon",e.icon),c=i.default.createElement("a",{href:e.url||"#",className:"p-menuitem-link",target:e.target,onClick:function(n){return a.itemClick(n,e,t)},role:"presentation"},e.icon&&i.default.createElement("span",{className:u}),e.label&&i.default.createElement("span",{className:"p-menuitem-text"},e.label),i.default.createElement(r.Ripple,null));return e.template&&(c=n.ObjectUtils.getJSXElement(e.template,e,{onClick:function(t){return a.itemClick(t,e)},className:"p-menuitem-link",labelClassName:"p-menuitem-text",iconClassName:u,element:c,props:this.props,active:o,index:t})),i.default.createElement("li",{ref:function(e){return a["tab_".concat(t)]=e},key:e.label+"_"+t,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){var t=n.classNames("p-tabmenu p-component",this.props.className),r=this.renderItems();return i.default.createElement("div",{id:this.props.id,className:t,style:this.props.style},i.default.createElement("ul",{ref:function(t){return e.nav=t},className:"p-tabmenu-nav p-reset",role:"tablist"},r,i.default.createElement("li",{ref:function(t){return e.inkbar=t},className:"p-tabmenu-ink-bar"})))}return null}}])&&l(u.prototype,s),p&&l(u,p),Object.defineProperty(u,"prototype",{writable:!1}),y}(t.Component);return h={id:null,model:null,activeIndex:0,style:null,className:null,onTabChange:null},(y="defaultProps")in(b=v)?Object.defineProperty(b,y,{value:h,enumerable:!0,configurable:!0,writable:!0}):b[y]=h,e.TabMenu=v,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils,primereact.ripple);