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

2 lines
3.2 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");function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=t(e);function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}function i(e,t){return i=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},i(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&&i(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 l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(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 l(e)}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function s(){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,p,y,h=function(t){u(h,e.Component);var i,c,l,d,p,y=(i=h,c=s(),function(){var e,t=f(i);if(c){var n=f(this).constructor;e=Reflect.construct(t,arguments,n)}else e=t.apply(this,arguments);return a(this,e)});function h(e){var t;return o(this,h),(t=y.call(this,e)).state={loaded:!1},t}return l=h,(d=[{key:"componentDidMount",value:function(){this.state.loaded||(this.shouldLoad()?this.load():this.bindScrollListener())}},{key:"bindScrollListener",value:function(){var e=this;this.documentScrollListener=function(){e.shouldLoad()&&(e.load(),e.unbindScrollListener())},window.addEventListener("scroll",this.documentScrollListener)}},{key:"unbindScrollListener",value:function(){this.documentScrollListener&&(window.removeEventListener("scroll",this.documentScrollListener),this.documentScrollListener=null)}},{key:"shouldLoad",value:function(){if(this.state.loaded)return!1;var e=this.container.getBoundingClientRect();return document.documentElement.clientHeight>=e.top}},{key:"load",value:function(e){this.setState({loaded:!0}),this.props.onLoad&&this.props.onLoad(e)}},{key:"componentWillUnmount",value:function(){this.unbindScrollListener()}},{key:"render",value:function(){var e=this;return n.default.createElement("div",{ref:function(t){return e.container=t}},this.state.loaded?this.props.children:null)}}])&&r(l.prototype,d),p&&r(l,p),Object.defineProperty(l,"prototype",{writable:!1}),h}();y={onload:null},(p="defaultProps")in(d=h)?Object.defineProperty(d,p,{value:y,enumerable:!0,configurable:!0,writable:!0}):d[p]=y,exports.DeferredContent=h;