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

2 lines
5.2 KiB
JavaScript
Raw Normal View History

2022-07-06 04:15:11 +00:00
this.primereact=this.primereact||{},this.primereact.scrolltop=function(e,t,n,r,o,i){"use strict";function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var s=l(t),c=l(i);function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(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 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){return f=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},f(e,t)}function h(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&&f(e,t)}function d(e){return d="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},d(e)}function y(e,t){if(t&&("object"===d(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 b(){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 v,E,w,k=function(e){h(E,e);var t,i,l,f,d,v=(t=E,i=b(),function(){var e,n=m(t);if(i){var r=m(this).constructor;e=Reflect.construct(n,arguments,r)}else e=n.apply(this,arguments);return y(this,e)});function E(e){var t;return u(this,E),(t=v.call(this,e)).state={visible:!1},t.onClick=t.onClick.bind(p(t)),t.onEnter=t.onEnter.bind(p(t)),t.onEntered=t.onEntered.bind(p(t)),t.onExited=t.onExited.bind(p(t)),t.scrollElementRef=s.default.createRef(),t}return l=E,(f=[{key:"onClick",value:function(){("window"===this.props.target?window:this.helper.parentElement).scroll({top:0,behavior:this.props.behavior})}},{key:"checkVisibility",value:function(e){this.setState({visible:e>this.props.threshold})}},{key:"bindParentScrollListener",value:function(){var e=this;this.scrollListener=function(){e.checkVisibility(e.helper.parentElement.scrollTop)},this.helper.parentElement.addEventListener("scroll",this.scrollListener)}},{key:"bindDocumentScrollListener",value:function(){var e=this;this.scrollListener=function(){e.checkVisibility(n.DomHandler.getWindowScrollTop())},window.addEventListener("scroll",this.scrollListener)}},{key:"unbindParentScrollListener",value:function(){this.scrollListener&&(this.helper.parentElement.removeEventListener("scroll",this.scrollListener),this.scrollListener=null)}},{key:"unbindDocumentScrollListener",value:function(){this.scrollListener&&(window.removeEventListener("scroll",this.scrollListener),this.scrollListener=null)}},{key:"onEnter",value:function(){n.ZIndexUtils.set("overlay",this.scrollElementRef.current,c.default.autoZIndex,c.default.zIndex.overlay)}},{key:"onEntered",value:function(){this.props.onShow&&this.props.onShow()}},{key:"onExited",value:function(){n.ZIndexUtils.clear(this.scrollElementRef.current),this.props.onHide&&this.props.onHide()}},{key:"componentDidMount",value:function(){"window"===this.props.target?this.bindDocumentScrollListener():"parent"===this.props.target&&this.bindParentScrollListener()}},{key:"componentWillUnmount",value:function(){"window"===this.props.target?this.unbindDocumentScrollListener():"parent"===this.props.target&&this.unbindParentScrollListener(),n.ZIndexUtils.clear(this.scrollElementRef.current)}},{key:"render",value:function(){var e=this,t=n.classNames("p-scrolltop p-link p-component",{"p-scrolltop-sticky":"window"!==this.props.target},this.props.className),i="pare