-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvendors~react-window.js
More file actions
1 lines (1 loc) · 7.97 KB
/
vendors~react-window.js
File metadata and controls
1 lines (1 loc) · 7.97 KB
1
(window.webpackJsonp=window.webpackJsonp||[]).push([[3],{409:function(t,e,r){"use strict";r.d(e,"a",function(){return S});var n=r(11),o=r(27),i=r(405),l=r(408),s=r(1),a=(r(59),"object"==typeof performance&&"function"==typeof performance.now?function(){return performance.now()}:function(){return Date.now()});function c(t){cancelAnimationFrame(t.id)}function u(t,e){var r=a();var n={id:requestAnimationFrame(function o(){a()-r>=e?t.call(null):n.id=requestAnimationFrame(o)})};return n}var f=null;function d(t){if(void 0===t&&(t=!1),null===f||t){var e=document.createElement("div"),r=e.style;r.width="50px",r.height="50px",r.overflow="scroll",r.direction="rtl";var n=document.createElement("div"),o=n.style;return o.width="100px",o.height="100px",e.appendChild(n),document.body.appendChild(e),e.scrollLeft>0?f="positive-descending":(e.scrollLeft=1,f=0===e.scrollLeft?"negative":"positive-ascending"),document.body.removeChild(e),f}return f}var h=150,p=function(t,e){return t};function m(t){var e,r,a=t.getItemOffset,f=t.getEstimatedTotalSize,m=t.getItemSize,S=t.getOffsetForIndexAndAlignment,v=t.getStartIndexForOffset,I=t.getStopIndexForStartIndex,_=t.initInstanceProps,O=t.shouldResetStyleCacheOnItemSizeChange,y=t.validateProps;return r=e=function(t){function e(e){var r;return(r=t.call(this,e)||this)._instanceProps=_(r.props,Object(i.a)(Object(i.a)(r))),r._outerRef=void 0,r._resetIsScrollingTimeoutId=null,r.state={instance:Object(i.a)(Object(i.a)(r)),isScrolling:!1,scrollDirection:"forward",scrollOffset:"number"==typeof r.props.initialScrollOffset?r.props.initialScrollOffset:0,scrollUpdateWasRequested:!1},r._callOnItemsRendered=void 0,r._callOnItemsRendered=Object(l.a)(function(t,e,n,o){return r.props.onItemsRendered({overscanStartIndex:t,overscanStopIndex:e,visibleStartIndex:n,visibleStopIndex:o})}),r._callOnScroll=void 0,r._callOnScroll=Object(l.a)(function(t,e,n){return r.props.onScroll({scrollDirection:t,scrollOffset:e,scrollUpdateWasRequested:n})}),r._getItemStyle=void 0,r._getItemStyle=function(t){var e,n=r.props,o=n.direction,i=n.itemSize,l=n.layout,s=r._getItemStyleCache(O&&i,O&&l,O&&o);if(s.hasOwnProperty(t))e=s[t];else{var c,u=a(r.props,t,r._instanceProps),f=m(r.props,t,r._instanceProps),d="horizontal"===o||"horizontal"===l;s[t]=((c={position:"absolute"})["rtl"===o?"right":"left"]=d?u:0,c.top=d?0:u,c.height=d?"100%":f,c.width=d?f:"100%",e=c)}return e},r._getItemStyleCache=void 0,r._getItemStyleCache=Object(l.a)(function(t,e,r){return{}}),r._onScrollHorizontal=function(t){var e=t.currentTarget,n=e.clientWidth,o=e.scrollLeft,i=e.scrollWidth;r.setState(function(t){if(t.scrollOffset===o)return null;var e=r.props.direction,l=o;if("rtl"===e)switch(d()){case"negative":l=-o;break;case"positive-descending":l=i-n-o}return l=Math.max(0,Math.min(l,i-n)),{isScrolling:!0,scrollDirection:t.scrollOffset<o?"forward":"backward",scrollOffset:l,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._onScrollVertical=function(t){var e=t.currentTarget,n=e.clientHeight,o=e.scrollHeight,i=e.scrollTop;r.setState(function(t){if(t.scrollOffset===i)return null;var e=Math.max(0,Math.min(i,o-n));return{isScrolling:!0,scrollDirection:t.scrollOffset<e?"forward":"backward",scrollOffset:e,scrollUpdateWasRequested:!1}},r._resetIsScrollingDebounced)},r._outerRefSetter=function(t){var e=r.props.outerRef;r._outerRef=t,"function"==typeof e?e(t):null!=e&&"object"==typeof e&&e.hasOwnProperty("current")&&(e.current=t)},r._resetIsScrollingDebounced=function(){null!==r._resetIsScrollingTimeoutId&&c(r._resetIsScrollingTimeoutId),r._resetIsScrollingTimeoutId=u(r._resetIsScrolling,h)},r._resetIsScrolling=function(){r._resetIsScrollingTimeoutId=null,r.setState({isScrolling:!1},function(){r._getItemStyleCache(-1,null)})},r}Object(o.a)(e,t),e.getDerivedStateFromProps=function(t,e){return g(t,e),y(t),null};var r=e.prototype;return r.scrollTo=function(t){t=Math.max(0,t),this.setState(function(e){return e.scrollOffset===t?null:{scrollDirection:e.scrollOffset<t?"forward":"backward",scrollOffset:t,scrollUpdateWasRequested:!0}},this._resetIsScrollingDebounced)},r.scrollToItem=function(t,e){void 0===e&&(e="auto");var r=this.props.itemCount,n=this.state.scrollOffset;t=Math.max(0,Math.min(t,r-1)),this.scrollTo(S(this.props,t,e,n,this._instanceProps))},r.componentDidMount=function(){var t=this.props,e=t.direction,r=t.initialScrollOffset,n=t.layout;if("number"==typeof r&&null!=this._outerRef){var o=this._outerRef;"horizontal"===e||"horizontal"===n?o.scrollLeft=r:o.scrollTop=r}this._callPropsCallbacks()},r.componentDidUpdate=function(){var t=this.props,e=t.direction,r=t.layout,n=this.state,o=n.scrollOffset;if(n.scrollUpdateWasRequested&&null!=this._outerRef){var i=this._outerRef;if("horizontal"===e||"horizontal"===r)if("rtl"===e)switch(d()){case"negative":i.scrollLeft=-o;break;case"positive-ascending":i.scrollLeft=o;break;default:var l=i.clientWidth,s=i.scrollWidth;i.scrollLeft=s-l-o}else i.scrollLeft=o;else i.scrollTop=o}this._callPropsCallbacks()},r.componentWillUnmount=function(){null!==this._resetIsScrollingTimeoutId&&c(this._resetIsScrollingTimeoutId)},r.render=function(){var t=this.props,e=t.children,r=t.className,o=t.direction,i=t.height,l=t.innerRef,a=t.innerElementType,c=t.innerTagName,u=t.itemCount,d=t.itemData,h=t.itemKey,m=void 0===h?p:h,g=t.layout,S=t.outerElementType,v=t.outerTagName,I=t.style,_=t.useIsScrolling,O=t.width,y=this.state.isScrolling,b="horizontal"===o||"horizontal"===g,w=b?this._onScrollHorizontal:this._onScrollVertical,R=this._getRangeToRender(),x=R[0],z=R[1],C=[];if(u>0)for(var T=x;T<=z;T++)C.push(Object(s.createElement)(e,{data:d,key:m(T,d),index:T,isScrolling:_?y:void 0,style:this._getItemStyle(T)}));var M=f(this.props,this._instanceProps);return Object(s.createElement)(S||v||"div",{className:r,onScroll:w,ref:this._outerRefSetter,style:Object(n.a)({position:"relative",height:i,width:O,overflow:"auto",WebkitOverflowScrolling:"touch",willChange:"transform",direction:o},I)},Object(s.createElement)(a||c||"div",{children:C,ref:l,style:{height:b?"100%":M,pointerEvents:y?"none":void 0,width:b?M:"100%"}}))},r._callPropsCallbacks=function(){if("function"==typeof this.props.onItemsRendered&&this.props.itemCount>0){var t=this._getRangeToRender(),e=t[0],r=t[1],n=t[2],o=t[3];this._callOnItemsRendered(e,r,n,o)}if("function"==typeof this.props.onScroll){var i=this.state,l=i.scrollDirection,s=i.scrollOffset,a=i.scrollUpdateWasRequested;this._callOnScroll(l,s,a)}},r._getRangeToRender=function(){var t=this.props,e=t.itemCount,r=t.overscanCount,n=this.state,o=n.isScrolling,i=n.scrollDirection,l=n.scrollOffset;if(0===e)return[0,0,0,0];var s=v(this.props,l,this._instanceProps),a=I(this.props,s,l,this._instanceProps),c=o&&"backward"!==i?1:Math.max(1,r),u=o&&"forward"!==i?1:Math.max(1,r);return[Math.max(0,s-c),Math.max(0,Math.min(e-1,a+u)),s,a]},e}(s.PureComponent),e.defaultProps={direction:"ltr",itemData:void 0,layout:"vertical",overscanCount:2,useIsScrolling:!1},r}var g=function(t,e){t.children,t.direction,t.height,t.layout,t.innerTagName,t.outerTagName,t.width,e.instance},S=m({getItemOffset:function(t,e){return e*t.itemSize},getItemSize:function(t,e){return t.itemSize},getEstimatedTotalSize:function(t){var e=t.itemCount;return t.itemSize*e},getOffsetForIndexAndAlignment:function(t,e,r,n){var o=t.direction,i=t.height,l=t.itemCount,s=t.itemSize,a=t.layout,c=t.width,u="horizontal"===o||"horizontal"===a?c:i,f=Math.max(0,l*s-u),d=Math.min(f,e*s),h=Math.max(0,e*s-u+s);switch("smart"===r&&(r=n>=h-u&&n<=d+u?"auto":"center"),r){case"start":return d;case"end":return h;case"center":var p=Math.round(h+(d-h)/2);return p<Math.ceil(u/2)?0:p>f+Math.floor(u/2)?f:p;case"auto":default:return n>=h&&n<=d?n:n<h?h:d}},getStartIndexForOffset:function(t,e){var r=t.itemCount,n=t.itemSize;return Math.max(0,Math.min(r-1,Math.floor(e/n)))},getStopIndexForStartIndex:function(t,e,r){var n=t.direction,o=t.height,i=t.itemCount,l=t.itemSize,s=t.layout,a=t.width,c=e*l,u="horizontal"===n||"horizontal"===s?a:o,f=Math.ceil((u+r-c)/l);return Math.max(0,Math.min(i-1,e+f-1))},initInstanceProps:function(t){},shouldResetStyleCacheOnItemSizeChange:!0,validateProps:function(t){t.itemSize}})}}]);