You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
10 KiB
1 line
10 KiB
(self.webpackChunk=self.webpackChunk||[]).push([[13488],{27666:function(e,t,o){"use strict";var n=o(94480),r=o(16089);t.Z=function(e){let t;const o=o=>()=>{t=null,e.apply(void 0,(0,n.Z)(o))},s=function(){if(null==t){for(var e=arguments.length,n=new Array(e),s=0;s<e;s++)n[s]=arguments[s];t=(0,r.Z)(o(n))}};return s.cancel=()=>{r.Z.cancel(t),t=null},s}},81228:function(e,t,o){"use strict";o.d(t,{Z:function(){return S}});var n=o(67732),r=o(83652),s=o(42403),i=o(79493),l=o(59301),a=o(92310),u=o.n(a),p=o(29301),f=o(2738),c=o(27666),d=o(36355),h=o(83116),v=o(37613);const m=e=>{const{componentCls:t}=e;return{[t]:{position:"fixed",zIndex:e.zIndexPopup}}};var g=(0,h.Z)("Affix",(e=>{const t=(0,v.TS)(e,{zIndexPopup:e.zIndexBase+10});return[m(t)]}));function y(e){return e!==window?e.getBoundingClientRect():{top:0,bottom:window.innerHeight}}function w(e,t,o){if(void 0!==o&&t.top>e.top-o)return o+t.top}function L(e,t,o){if(void 0!==o&&t.bottom<e.bottom+o){return o+(window.innerHeight-t.bottom)}}const P=["resize","scroll","touchstart","touchmove","touchend","pageshow","load"];function b(){return"undefined"!=typeof window?window:null}var C;!function(e){e[e.None=0]="None",e[e.Prepare=1]="Prepare"}(C||(C={}));let x=function(e){(0,s.Z)(o,e);var t=(0,i.Z)(o);function o(){var e;return(0,n.Z)(this,o),(e=t.apply(this,arguments)).state={status:C.None,lastAffix:!1,prevTarget:null},e.placeholderNodeRef=(0,l.createRef)(),e.fixedNodeRef=(0,l.createRef)(),e.addListeners=()=>{const t=e.getTargetFunc(),o=null==t?void 0:t(),{prevTarget:n}=e.state;n!==o&&(P.forEach((t=>{null==n||n.removeEventListener(t,e.lazyUpdatePosition),null==o||o.addEventListener(t,e.lazyUpdatePosition)})),e.updatePosition(),e.setState({prevTarget:o}))},e.removeListeners=()=>{e.timer&&(clearTimeout(e.timer),e.timer=null);const{prevTarget:t}=e.state,o=e.getTargetFunc(),n=null==o?void 0:o();P.forEach((o=>{null==n||n.removeEventListener(o,e.lazyUpdatePosition),null==t||t.removeEventListener(o,e.lazyUpdatePosition)})),e.updatePosition.cancel(),e.lazyUpdatePosition.cancel()},e.getOffsetTop=()=>{const{offsetBottom:t,offsetTop:o}=e.props;return void 0===t&&void 0===o?0:o},e.getOffsetBottom=()=>e.props.offsetBottom,e.measure=()=>{const{status:t,lastAffix:o}=e.state,{onChange:n}=e.props,r=e.getTargetFunc();if(t!==C.Prepare||!e.fixedNodeRef.current||!e.placeholderNodeRef.current||!r)return;const s=e.getOffsetTop(),i=e.getOffsetBottom(),l=r();if(l){const t={status:C.None},r=y(e.placeholderNodeRef.current);if(0===r.top&&0===r.left&&0===r.width&&0===r.height)return;const a=y(l),u=w(r,a,s),p=L(r,a,i);void 0!==u?(t.affixStyle={position:"fixed",top:u,width:r.width,height:r.height},t.placeholderStyle={width:r.width,height:r.height}):void 0!==p&&(t.affixStyle={position:"fixed",bottom:p,width:r.width,height:r.height},t.placeholderStyle={width:r.width,height:r.height}),t.lastAffix=!!t.affixStyle,n&&o!==t.lastAffix&&n(t.lastAffix),e.setState(t)}},e.prepareMeasure=()=>{e.setState({status:C.Prepare,affixStyle:void 0,placeholderStyle:void 0})},e.updatePosition=(0,c.Z)((()=>{e.prepareMeasure()})),e.lazyUpdatePosition=(0,c.Z)((()=>{const t=e.getTargetFunc(),{affixStyle:o}=e.state;if(t&&o){const n=e.getOffsetTop(),r=e.getOffsetBottom(),s=t();if(s&&e.placeholderNodeRef.current){const t=y(s),i=y(e.placeholderNodeRef.current),l=w(i,t,n),a=L(i,t,r);if(void 0!==l&&o.top===l||void 0!==a&&o.bottom===a)return}}e.prepareMeasure()})),e}return(0,r.Z)(o,[{key:"getTargetFunc",value:function(){const{getTargetContainer:e}=this.context,{target:t}=this.props;return void 0!==t?t:null!=e?e:b}},{key:"componentDidMount",value:function(){this.timer=setTimeout(this.addListeners)}},{key:"componentDidUpdate",value:function(e){this.addListeners(),e.offsetTop===this.props.offsetTop&&e.offsetBottom===this.props.offsetBottom||this.updatePosition(),this.measure()}},{key:"componentWillUnmount",value:function(){this.removeListeners()}},{key:"render",value:function(){const{affixStyle:e,placeholderStyle:t}=this.state,{affixPrefixCls:o,rootClassName:n,children:r}=this.props,s=u()(e&&n,{[o]:!!e});let i=(0,f.Z)(this.props,["prefixCls","offsetTop","offsetBottom","target","onChange","affixPrefixCls","rootClassName"]);return l.createElement(p.Z,{onResize:this.updatePosition},l.createElement("div",Object.assign({},i,{ref:this.placeholderNodeRef}),e&&l.createElement("div",{style:t,"aria-hidden":"true"}),l.createElement("div",{className:s,ref:this.fixedNodeRef,style:e},l.createElement(p.Z,{onResize:this.updatePosition},r))))}}]),o}(l.Component);x.contextType=d.E_;var S=(0,l.forwardRef)(((e,t)=>{const{prefixCls:o,rootClassName:n}=e,{getPrefixCls:r}=(0,l.useContext)(d.E_),s=r("affix",o),[i,a]=g(s),p=Object.assign(Object.assign({},e),{affixPrefixCls:s,rootClassName:u()(n,a)});return i(l.createElement(x,Object.assign({},p,{ref:t})))}))},51581:function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(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)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),r=o(59301),s=l(r),i=l(o(12708));function l(e){return e&&e.__esModule?e:{default:e}}var a=function(e){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t);var o=function(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e));return o.scrollListener=o.scrollListener.bind(o),o.eventListenerOptions=o.eventListenerOptions.bind(o),o.mousewheelListener=o.mousewheelListener.bind(o),o}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}(t,e),n(t,[{key:"componentDidMount",value:function(){this.pageLoaded=this.props.pageStart,this.options=this.eventListenerOptions(),this.attachScrollListener()}},{key:"componentDidUpdate",value:function(){if(this.props.isReverse&&this.loadMore){var e=this.getParentElement(this.scrollComponent);e.scrollTop=e.scrollHeight-this.beforeScrollHeight+this.beforeScrollTop,this.loadMore=!1}this.attachScrollListener()}},{key:"componentWillUnmount",value:function(){this.detachScrollListener(),this.detachMousewheelListener()}},{key:"isPassiveSupported",value:function(){var e=!1,t={get passive(){e=!0}};try{document.addEventListener("test",null,t),document.removeEventListener("test",null,t)}catch(e){}return e}},{key:"eventListenerOptions",value:function(){var e=this.props.useCapture;return this.isPassiveSupported()&&(e={useCapture:this.props.useCapture,passive:!0}),e}},{key:"setDefaultLoader",value:function(e){this.defaultLoader=e}},{key:"detachMousewheelListener",value:function(){var e=window;!1===this.props.useWindow&&(e=this.scrollComponent.parentNode),e.removeEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture)}},{key:"detachScrollListener",value:function(){var e=window;!1===this.props.useWindow&&(e=this.getParentElement(this.scrollComponent)),e.removeEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),e.removeEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture)}},{key:"getParentElement",value:function(e){var t=this.props.getScrollParent&&this.props.getScrollParent();return null!=t?t:e&&e.parentNode}},{key:"filterProps",value:function(e){return e}},{key:"attachScrollListener",value:function(){var e=this.getParentElement(this.scrollComponent);if(this.props.hasMore&&e){var t=window;!1===this.props.useWindow&&(t=e),t.addEventListener("mousewheel",this.mousewheelListener,this.options?this.options:this.props.useCapture),t.addEventListener("scroll",this.scrollListener,this.options?this.options:this.props.useCapture),t.addEventListener("resize",this.scrollListener,this.options?this.options:this.props.useCapture),this.props.initialLoad&&this.scrollListener()}}},{key:"mousewheelListener",value:function(e){1!==e.deltaY||this.isPassiveSupported()||e.preventDefault()}},{key:"scrollListener",value:function(){var e=this.scrollComponent,t=window,o=this.getParentElement(e),n=void 0;if(this.props.useWindow){var r=document.documentElement||document.body.parentNode||document.body,s=void 0!==t.pageYOffset?t.pageYOffset:r.scrollTop;n=this.props.isReverse?s:this.calculateOffset(e,s)}else n=this.props.isReverse?o.scrollTop:e.scrollHeight-o.scrollTop-o.clientHeight;n<Number(this.props.threshold)&&e&&null!==e.offsetParent&&(this.detachScrollListener(),this.beforeScrollHeight=o.scrollHeight,this.beforeScrollTop=o.scrollTop,"function"==typeof this.props.loadMore&&(this.props.loadMore(this.pageLoaded+=1),this.loadMore=!0))}},{key:"calculateOffset",value:function(e,t){return e?this.calculateTopPosition(e)+(e.offsetHeight-t-window.innerHeight):0}},{key:"calculateTopPosition",value:function(e){return e?e.offsetTop+this.calculateTopPosition(e.offsetParent):0}},{key:"render",value:function(){var e=this,t=this.filterProps(this.props),o=t.children,n=t.element,r=t.hasMore,i=(t.initialLoad,t.isReverse),l=t.loader,a=(t.loadMore,t.pageStart,t.ref),u=(t.threshold,t.useCapture,t.useWindow,t.getScrollParent,function(e,t){var o={};for(var n in e)t.indexOf(n)>=0||Object.prototype.hasOwnProperty.call(e,n)&&(o[n]=e[n]);return o}(t,["children","element","hasMore","initialLoad","isReverse","loader","loadMore","pageStart","ref","threshold","useCapture","useWindow","getScrollParent"]));u.ref=function(t){e.scrollComponent=t,a&&a(t)};var p=[o];return r&&(l?i?p.unshift(l):p.push(l):this.defaultLoader&&(i?p.unshift(this.defaultLoader):p.push(this.defaultLoader))),s.default.createElement(n,u,p)}}]),t}(r.Component);a.propTypes={children:i.default.node.isRequired,element:i.default.node,hasMore:i.default.bool,initialLoad:i.default.bool,isReverse:i.default.bool,loader:i.default.node,loadMore:i.default.func.isRequired,pageStart:i.default.number,ref:i.default.func,getScrollParent:i.default.func,threshold:i.default.number,useCapture:i.default.bool,useWindow:i.default.bool},a.defaultProps={element:"div",hasMore:!1,initialLoad:!0,pageStart:0,ref:null,threshold:250,useWindow:!0,isReverse:!1,useCapture:!1,loader:null,getScrollParent:null},t.default=a,e.exports=t.default},26724:function(e,t,o){e.exports=o(51581)}}]); |