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

2 lines
6.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");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=o(e);function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t){return s=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},s(e,t)}function l(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&&s(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 u(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 i(e)}function p(e){return p=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},p(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 h,m,f,v=function(o){l(y,e.Component);var s,c,h,m,f,v=(s=y,c=d(),function(){var e,t=p(s);if(c){var o=p(this).constructor;e=Reflect.construct(t,arguments,o)}else e=t.apply(this,arguments);return u(this,e)});function y(e){var t;return r(this,y),(t=v.call(this,e)).moveBar=t.moveBar.bind(i(t)),t.onXBarMouseDown=t.onXBarMouseDown.bind(i(t)),t.onYBarMouseDown=t.onYBarMouseDown.bind(i(t)),t.onDocumentMouseMove=t.onDocumentMouseMove.bind(i(t)),t.onDocumentMouseUp=t.onDocumentMouseUp.bind(i(t)),t}return h=y,(m=[{key:"calculateContainerHeight",value:function(){var e=getComputedStyle(this.container),o=getComputedStyle(this.xBar),n=t.DomHandler.getHeight(this.container)-parseInt(o.height,10);"none"!==e["max-height"]&&0===n&&(this.container.style.height=this.content.offsetHeight+parseInt(o.height,10)>parseInt(e["max-height"],10)?e["max-height"]:this.content.offsetHeight+parseFloat(e.paddingTop)+parseFloat(e.paddingBottom)+parseFloat(e.borderTopWidth)+parseFloat(e.borderBottomWidth)+"px")}},{key:"moveBar",value:function(){var e=this,o=this.content.scrollWidth,n=-1*(this.container.clientHeight-this.xBar.clientHeight);this.scrollXRatio=this.content.clientWidth/o;var r=this.content.scrollHeight,a=-1*(this.container.clientWidth-this.yBar.clientWidth);this.scrollYRatio=this.content.clientHeight/r,this.frame=this.requestAnimationFrame((function(){e.scrollXRatio>=1?t.DomHandler.addClass(e.xBar,"p-scrollpanel-hidden"):(t.DomHandler.removeClass(e.xBar,"p-scrollpanel-hidden"),e.xBar.style.cssText="width:"+Math.max(100*e.scrollXRatio,10)+"%; left:"+e.content.scrollLeft/o*100+"%;bottom:"+n+"px;"),e.scrollYRatio>=1?t.DomHandler.addClass(e.yBar,"p-scrollpanel-hidden"):(t.DomHandler.removeClass(e.yBar,"p-scrollpanel-hidden"),e.yBar.style.cssText="height:"+Math.max(100*e.scrollYRatio,10)+"%; top: calc("+e.content.scrollTop/r*100+"% - "+e.xBar.clientHeight+"px);right:"+a+"px;")}))}},{key:"onYBarMouseDown",value:function(e){this.isYBarClicked=!0,this.lastPageY=e.pageY,t.DomHandler.addClass(this.yBar,"p-scrollpanel-grabbed"),t.DomHandler.addClass(document.body,"p-scrollpanel-grabbed"),document.addEventListener("mousemove",this.onDocumentMouseMove),document.addEventListener("mouseup",this.onDocumentMouseUp),e.preventDefault()}},{key:"onXBarMouseDown",value:function(e){this.isXBarClicked=!0,this.lastPageX=e.pageX,t.DomHandler.addClass