2 lines
4.9 KiB
JavaScript
2 lines
4.9 KiB
JavaScript
this.primereact=this.primereact||{},this.primereact.dock=function(e,t,n,r){"use strict";function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=o(t);function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function s(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 a(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}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 p(e){return p="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},p(e)}function f(e,t){if(t&&("object"===p(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return a(e)}function d(e){return d=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},d(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 y,h,b,v=function(e){u(b,e);var t,o,l,p,y,h=(t=b,o=m(),function(){var e,n=d(t);if(o){var r=d(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return f(this,e)});function b(e){var t;return c(this,b),(t=h.call(this,e)).state={currentIndex:-3},t.onListMouseLeave=t.onListMouseLeave.bind(a(t)),t}return l=b,(p=[{key:"onListMouseLeave",value:function(){this.setState({currentIndex:-3})}},{key:"onItemMouseEnter",value:function(e){this.setState({currentIndex:e})}},{key:"onItemClick",value:function(e,t){t.command&&t.command({originalEvent:e,item:t}),e.preventDefault()}},{key:"renderItem",value:function(e,t){var o=this,c=e.disabled,s=e.icon,a=e.label,l=e.template,u=e.url,p=e.target,f=n.classNames("p-dock-item",{"p-dock-item-second-prev":this.state.currentIndex-2===t,"p-dock-item-prev":this.state.currentIndex-1===t,"p-dock-item-current":this.state.currentIndex===t,"p-dock-item-next":this.state.currentIndex+1===t,"p-dock-item-second-next":this.state.currentIndex+2===t}),d=n.classNames("p-dock-action",{"p-disabled":c}),m=n.classNames("p-dock-action-icon",s),y="string"==typeof s?i.default.createElement("span",{className:m}):n.ObjectUtils.getJSXElement(s,this.props),h=i.default.createElement("a",{href:u||"#",role:"menuitem",className:d,target:p,"data-pr-tooltip":a,onClick:function(t){return o.onItemClick(t,e)}},y,i.default.createElement(r.Ripple,null));return l&&(h=n.ObjectUtils.getJSXElement(l,e,{onClick:function(t){return o.onItemClick(t,e)},className:d,iconClassName:m,element:h,props:this.props,index:t})),i.default.createElement("li",{key:t,className:f,role:"none",onMouseEnter:function(){return o.onItemMouseEnter(t)}},h)}},{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:"renderHeader",value:function(){return this.props.header?i.default.createElement("div",{className:"p-dock-header"},n.ObjectUtils.getJSXElement(this.props.header,{props:this.props})):null}},{key:"renderList",value:function(){var e=this,t=this.renderItems();return i.default.createElement("ul",{ref:function(t){return e.list=t},className:"p-dock-list",role:"menu",onMouseLeave:this.onListMouseLeave},t)}},{key:"renderFooter",value:function(){return this.props.footer?i.default.createElement("div",{className:"p-dock-footer"},n.ObjectUtils.getJSXElement(this.props.footer,{props:this.props})):null}},{key:"render",value:function(){var e=n.classNames("p-dock p-component p-dock-".concat(this.props.position),{"p-dock-magnification":this.props.magnification},this.props.className),t=this.renderHeader(),r=this.renderList(),o=this.renderFooter();return i.default.createElement("div",{id:this.props.id,className:e,style:this.props.style},i.default.createElement("div",{className:"p-dock-container"},t,r,o))}}])&&s(l.prototype,p),y&&s(l,y),Object.defineProperty(l,"prototype",{writable:!1}),b}(t.Component);return b={id:null,style:null,className:null,model:null,position:"bottom",magnification:!0,header:null,footer:null},(h="defaultProps")in(y=v)?Object.defineProperty(y,h,{value:b,enumerable:!0,configurable:!0,writable:!0}):y[h]=b,e.Dock=v,Object.defineProperty(e,"__esModule",{value:!0}),e}({},React,primereact.utils,primereact.ripple);
|