"use strict"; (self["webpackChunk_core_volunteer_app"] = self["webpackChunk_core_volunteer_app"] || []).push([["vendors-node_modules_rc-virtual-list_es_index_js"],{ /***/ "../../../node_modules/rc-virtual-list/es/Filler.js": /*!**********************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/Filler.js ***! \**********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../../node_modules/@babel/runtime/helpers/esm/extends.js"); /* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ "../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"); /* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "../../../node_modules/@babel/runtime/helpers/esm/objectSpread2.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var rc_resize_observer__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rc-resize-observer */ "../../../node_modules/rc-resize-observer/es/index.js"); /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! classnames */ "../../../node_modules/classnames/index.js"); /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_5__); /** * Fill component to provided the scroll content real height. */ var Filler = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__.forwardRef(function (_ref, ref) { var height = _ref.height, offsetY = _ref.offsetY, offsetX = _ref.offsetX, children = _ref.children, prefixCls = _ref.prefixCls, onInnerResize = _ref.onInnerResize, innerProps = _ref.innerProps, rtl = _ref.rtl, extra = _ref.extra; var outerStyle = {}; var innerStyle = { display: 'flex', flexDirection: 'column' }; if (offsetY !== undefined) { // Not set `width` since this will break `sticky: right` outerStyle = { height: height, position: 'relative', overflow: 'hidden' }; innerStyle = (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__["default"])({}, innerStyle), {}, (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])({ transform: "translateY(".concat(offsetY, "px)") }, rtl ? 'marginRight' : 'marginLeft', -offsetX), "position", 'absolute'), "left", 0), "right", 0), "top", 0)); } return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__.createElement("div", { style: outerStyle }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__.createElement(rc_resize_observer__WEBPACK_IMPORTED_MODULE_4__["default"], { onResize: function onResize(_ref2) { var offsetHeight = _ref2.offsetHeight; if (offsetHeight && onInnerResize) { onInnerResize(); } } }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_3__.createElement("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ style: innerStyle, className: classnames__WEBPACK_IMPORTED_MODULE_5___default()((0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])({}, "".concat(prefixCls, "-holder-inner"), prefixCls)), ref: ref }, innerProps), children, extra))); }); Filler.displayName = 'Filler'; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Filler); /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/Item.js": /*!********************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/Item.js ***! \********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ Item: () => (/* binding */ Item) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); function Item(_ref) { var children = _ref.children, setRef = _ref.setRef; var refFunc = react__WEBPACK_IMPORTED_MODULE_0__.useCallback(function (node) { setRef(node); }, []); return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.cloneElement(children, { ref: refFunc }); } /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/List.js": /*!********************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/List.js ***! \********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ RawList: () => (/* binding */ RawList), /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/extends */ "../../../node_modules/@babel/runtime/helpers/esm/extends.js"); /* harmony import */ var _babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/typeof */ "../../../node_modules/@babel/runtime/helpers/esm/typeof.js"); /* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "../../../node_modules/@babel/runtime/helpers/esm/objectSpread2.js"); /* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ "../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"); /* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "../../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js"); /* harmony import */ var _babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectWithoutProperties */ "../../../node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js"); /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! classnames */ "../../../node_modules/classnames/index.js"); /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_6___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_6__); /* harmony import */ var rc_resize_observer__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! rc-resize-observer */ "../../../node_modules/rc-resize-observer/es/index.js"); /* harmony import */ var rc_util__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! rc-util */ "../../../node_modules/rc-util/es/index.js"); /* harmony import */ var rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! rc-util/es/hooks/useLayoutEffect */ "../../../node_modules/rc-util/es/hooks/useLayoutEffect.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_10___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_10__); /* harmony import */ var react_dom__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! react-dom */ "../../../node_modules/react-dom/index.js"); /* harmony import */ var _Filler__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Filler */ "../../../node_modules/rc-virtual-list/es/Filler.js"); /* harmony import */ var _hooks_useChildren__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./hooks/useChildren */ "../../../node_modules/rc-virtual-list/es/hooks/useChildren.js"); /* harmony import */ var _hooks_useDiffItem__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./hooks/useDiffItem */ "../../../node_modules/rc-virtual-list/es/hooks/useDiffItem.js"); /* harmony import */ var _hooks_useFrameWheel__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./hooks/useFrameWheel */ "../../../node_modules/rc-virtual-list/es/hooks/useFrameWheel.js"); /* harmony import */ var _hooks_useGetSize__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./hooks/useGetSize */ "../../../node_modules/rc-virtual-list/es/hooks/useGetSize.js"); /* harmony import */ var _hooks_useHeights__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./hooks/useHeights */ "../../../node_modules/rc-virtual-list/es/hooks/useHeights.js"); /* harmony import */ var _hooks_useMobileTouchMove__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./hooks/useMobileTouchMove */ "../../../node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js"); /* harmony import */ var _hooks_useOriginScroll__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./hooks/useOriginScroll */ "../../../node_modules/rc-virtual-list/es/hooks/useOriginScroll.js"); /* harmony import */ var _hooks_useScrollDrag__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./hooks/useScrollDrag */ "../../../node_modules/rc-virtual-list/es/hooks/useScrollDrag.js"); /* harmony import */ var _hooks_useScrollTo__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./hooks/useScrollTo */ "../../../node_modules/rc-virtual-list/es/hooks/useScrollTo.js"); /* harmony import */ var _ScrollBar__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./ScrollBar */ "../../../node_modules/rc-virtual-list/es/ScrollBar.js"); /* harmony import */ var _utils_scrollbarUtil__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./utils/scrollbarUtil */ "../../../node_modules/rc-virtual-list/es/utils/scrollbarUtil.js"); var _excluded = ["prefixCls", "className", "height", "itemHeight", "fullHeight", "style", "data", "children", "itemKey", "virtual", "direction", "scrollWidth", "component", "onScroll", "onVirtualScroll", "onVisibleChange", "innerProps", "extraRender", "styles", "showScrollBar"]; var EMPTY_DATA = []; var ScrollStyle = { overflowY: 'auto', overflowAnchor: 'none' }; function RawList(props, ref) { var _props$prefixCls = props.prefixCls, prefixCls = _props$prefixCls === void 0 ? 'rc-virtual-list' : _props$prefixCls, className = props.className, height = props.height, itemHeight = props.itemHeight, _props$fullHeight = props.fullHeight, fullHeight = _props$fullHeight === void 0 ? true : _props$fullHeight, style = props.style, data = props.data, children = props.children, itemKey = props.itemKey, virtual = props.virtual, direction = props.direction, scrollWidth = props.scrollWidth, _props$component = props.component, Component = _props$component === void 0 ? 'div' : _props$component, onScroll = props.onScroll, onVirtualScroll = props.onVirtualScroll, onVisibleChange = props.onVisibleChange, innerProps = props.innerProps, extraRender = props.extraRender, styles = props.styles, _props$showScrollBar = props.showScrollBar, showScrollBar = _props$showScrollBar === void 0 ? 'optional' : _props$showScrollBar, restProps = (0,_babel_runtime_helpers_esm_objectWithoutProperties__WEBPACK_IMPORTED_MODULE_5__["default"])(props, _excluded); // =============================== Item Key =============================== var getKey = react__WEBPACK_IMPORTED_MODULE_10__.useCallback(function (item) { if (typeof itemKey === 'function') { return itemKey(item); } return item === null || item === void 0 ? void 0 : item[itemKey]; }, [itemKey]); // ================================ Height ================================ var _useHeights = (0,_hooks_useHeights__WEBPACK_IMPORTED_MODULE_17__["default"])(getKey, null, null), _useHeights2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_4__["default"])(_useHeights, 4), setInstanceRef = _useHeights2[0], collectHeight = _useHeights2[1], heights = _useHeights2[2], heightUpdatedMark = _useHeights2[3]; // ================================= MISC ================================= var useVirtual = !!(virtual !== false && height && itemHeight); var containerHeight = react__WEBPACK_IMPORTED_MODULE_10__.useMemo(function () { return Object.values(heights.maps).reduce(function (total, curr) { return total + curr; }, 0); }, [heights.id, heights.maps]); var inVirtual = useVirtual && data && (Math.max(itemHeight * data.length, containerHeight) > height || !!scrollWidth); var isRTL = direction === 'rtl'; var mergedClassName = classnames__WEBPACK_IMPORTED_MODULE_6___default()(prefixCls, (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_3__["default"])({}, "".concat(prefixCls, "-rtl"), isRTL), className); var mergedData = data || EMPTY_DATA; var componentRef = (0,react__WEBPACK_IMPORTED_MODULE_10__.useRef)(); var fillerInnerRef = (0,react__WEBPACK_IMPORTED_MODULE_10__.useRef)(); var containerRef = (0,react__WEBPACK_IMPORTED_MODULE_10__.useRef)(); // =============================== Item Key =============================== var _useState = (0,react__WEBPACK_IMPORTED_MODULE_10__.useState)(0), _useState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_4__["default"])(_useState, 2), offsetTop = _useState2[0], setOffsetTop = _useState2[1]; var _useState3 = (0,react__WEBPACK_IMPORTED_MODULE_10__.useState)(0), _useState4 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_4__["default"])(_useState3, 2), offsetLeft = _useState4[0], setOffsetLeft = _useState4[1]; var _useState5 = (0,react__WEBPACK_IMPORTED_MODULE_10__.useState)(false), _useState6 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_4__["default"])(_useState5, 2), scrollMoving = _useState6[0], setScrollMoving = _useState6[1]; var onScrollbarStartMove = function onScrollbarStartMove() { setScrollMoving(true); }; var onScrollbarStopMove = function onScrollbarStopMove() { setScrollMoving(false); }; var sharedConfig = { getKey: getKey }; // ================================ Scroll ================================ function syncScrollTop(newTop) { setOffsetTop(function (origin) { var value; if (typeof newTop === 'function') { value = newTop(origin); } else { value = newTop; } var alignedTop = keepInRange(value); componentRef.current.scrollTop = alignedTop; return alignedTop; }); } // ================================ Legacy ================================ // Put ref here since the range is generate by follow var rangeRef = (0,react__WEBPACK_IMPORTED_MODULE_10__.useRef)({ start: 0, end: mergedData.length }); var diffItemRef = (0,react__WEBPACK_IMPORTED_MODULE_10__.useRef)(); var _useDiffItem = (0,_hooks_useDiffItem__WEBPACK_IMPORTED_MODULE_14__["default"])(mergedData, getKey), _useDiffItem2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_4__["default"])(_useDiffItem, 1), diffItem = _useDiffItem2[0]; diffItemRef.current = diffItem; // ========================== Visible Calculation ========================= var _React$useMemo = react__WEBPACK_IMPORTED_MODULE_10__.useMemo(function () { if (!useVirtual) { return { scrollHeight: undefined, start: 0, end: mergedData.length - 1, offset: undefined }; } // Always use virtual scroll bar in avoid shaking if (!inVirtual) { var _fillerInnerRef$curre; return { scrollHeight: ((_fillerInnerRef$curre = fillerInnerRef.current) === null || _fillerInnerRef$curre === void 0 ? void 0 : _fillerInnerRef$curre.offsetHeight) || 0, start: 0, end: mergedData.length - 1, offset: undefined }; } var itemTop = 0; var startIndex; var startOffset; var endIndex; var dataLen = mergedData.length; for (var i = 0; i < dataLen; i += 1) { var _item = mergedData[i]; var key = getKey(_item); var cacheHeight = heights.get(key); var currentItemBottom = itemTop + (cacheHeight === undefined ? itemHeight : cacheHeight); // Check item top in the range if (currentItemBottom >= offsetTop && startIndex === undefined) { startIndex = i; startOffset = itemTop; } // Check item bottom in the range. We will render additional one item for motion usage if (currentItemBottom > offsetTop + height && endIndex === undefined) { endIndex = i; } itemTop = currentItemBottom; } // When scrollTop at the end but data cut to small count will reach this if (startIndex === undefined) { startIndex = 0; startOffset = 0; endIndex = Math.ceil(height / itemHeight); } if (endIndex === undefined) { endIndex = mergedData.length - 1; } // Give cache to improve scroll experience endIndex = Math.min(endIndex + 1, mergedData.length - 1); return { scrollHeight: itemTop, start: startIndex, end: endIndex, offset: startOffset }; }, [inVirtual, useVirtual, offsetTop, mergedData, heightUpdatedMark, height]), scrollHeight = _React$useMemo.scrollHeight, start = _React$useMemo.start, end = _React$useMemo.end, fillerOffset = _React$useMemo.offset; rangeRef.current.start = start; rangeRef.current.end = end; // When scroll up, first visible item get real height may not same as `itemHeight`, // Which will make scroll jump. // Let's sync scroll top to avoid jump react__WEBPACK_IMPORTED_MODULE_10__.useLayoutEffect(function () { var changedRecord = heights.getRecord(); if (changedRecord.size === 1) { var recordKey = Array.from(changedRecord.keys())[0]; var prevCacheHeight = changedRecord.get(recordKey); // Quick switch data may cause `start` not in `mergedData` anymore var startItem = mergedData[start]; if (startItem && prevCacheHeight === undefined) { var startIndexKey = getKey(startItem); if (startIndexKey === recordKey) { var realStartHeight = heights.get(recordKey); var diffHeight = realStartHeight - itemHeight; syncScrollTop(function (ori) { return ori + diffHeight; }); } } } heights.resetRecord(); }, [scrollHeight]); // ================================= Size ================================= var _React$useState = react__WEBPACK_IMPORTED_MODULE_10__.useState({ width: 0, height: height }), _React$useState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_4__["default"])(_React$useState, 2), size = _React$useState2[0], setSize = _React$useState2[1]; var onHolderResize = function onHolderResize(sizeInfo) { setSize({ width: sizeInfo.offsetWidth, height: sizeInfo.offsetHeight }); }; // Hack on scrollbar to enable flash call var verticalScrollBarRef = (0,react__WEBPACK_IMPORTED_MODULE_10__.useRef)(); var horizontalScrollBarRef = (0,react__WEBPACK_IMPORTED_MODULE_10__.useRef)(); var horizontalScrollBarSpinSize = react__WEBPACK_IMPORTED_MODULE_10__.useMemo(function () { return (0,_utils_scrollbarUtil__WEBPACK_IMPORTED_MODULE_23__.getSpinSize)(size.width, scrollWidth); }, [size.width, scrollWidth]); var verticalScrollBarSpinSize = react__WEBPACK_IMPORTED_MODULE_10__.useMemo(function () { return (0,_utils_scrollbarUtil__WEBPACK_IMPORTED_MODULE_23__.getSpinSize)(size.height, scrollHeight); }, [size.height, scrollHeight]); // =============================== In Range =============================== var maxScrollHeight = scrollHeight - height; var maxScrollHeightRef = (0,react__WEBPACK_IMPORTED_MODULE_10__.useRef)(maxScrollHeight); maxScrollHeightRef.current = maxScrollHeight; function keepInRange(newScrollTop) { var newTop = newScrollTop; if (!Number.isNaN(maxScrollHeightRef.current)) { newTop = Math.min(newTop, maxScrollHeightRef.current); } newTop = Math.max(newTop, 0); return newTop; } var isScrollAtTop = offsetTop <= 0; var isScrollAtBottom = offsetTop >= maxScrollHeight; var isScrollAtLeft = offsetLeft <= 0; var isScrollAtRight = offsetLeft >= scrollWidth; var originScroll = (0,_hooks_useOriginScroll__WEBPACK_IMPORTED_MODULE_19__["default"])(isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight); // ================================ Scroll ================================ var getVirtualScrollInfo = function getVirtualScrollInfo() { return { x: isRTL ? -offsetLeft : offsetLeft, y: offsetTop }; }; var lastVirtualScrollInfoRef = (0,react__WEBPACK_IMPORTED_MODULE_10__.useRef)(getVirtualScrollInfo()); var triggerScroll = (0,rc_util__WEBPACK_IMPORTED_MODULE_8__.useEvent)(function (params) { if (onVirtualScroll) { var nextInfo = (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__["default"])({}, getVirtualScrollInfo()), params); // Trigger when offset changed if (lastVirtualScrollInfoRef.current.x !== nextInfo.x || lastVirtualScrollInfoRef.current.y !== nextInfo.y) { onVirtualScroll(nextInfo); lastVirtualScrollInfoRef.current = nextInfo; } } }); function onScrollBar(newScrollOffset, horizontal) { var newOffset = newScrollOffset; if (horizontal) { (0,react_dom__WEBPACK_IMPORTED_MODULE_11__.flushSync)(function () { setOffsetLeft(newOffset); }); triggerScroll(); } else { syncScrollTop(newOffset); } } // When data size reduce. It may trigger native scroll event back to fit scroll position function onFallbackScroll(e) { var newScrollTop = e.currentTarget.scrollTop; if (newScrollTop !== offsetTop) { syncScrollTop(newScrollTop); } // Trigger origin onScroll onScroll === null || onScroll === void 0 || onScroll(e); triggerScroll(); } var keepInHorizontalRange = function keepInHorizontalRange(nextOffsetLeft) { var tmpOffsetLeft = nextOffsetLeft; var max = !!scrollWidth ? scrollWidth - size.width : 0; tmpOffsetLeft = Math.max(tmpOffsetLeft, 0); tmpOffsetLeft = Math.min(tmpOffsetLeft, max); return tmpOffsetLeft; }; var onWheelDelta = (0,rc_util__WEBPACK_IMPORTED_MODULE_8__.useEvent)(function (offsetXY, fromHorizontal) { if (fromHorizontal) { (0,react_dom__WEBPACK_IMPORTED_MODULE_11__.flushSync)(function () { setOffsetLeft(function (left) { var nextOffsetLeft = left + (isRTL ? -offsetXY : offsetXY); return keepInHorizontalRange(nextOffsetLeft); }); }); triggerScroll(); } else { syncScrollTop(function (top) { var newTop = top + offsetXY; return newTop; }); } }); // Since this added in global,should use ref to keep update var _useFrameWheel = (0,_hooks_useFrameWheel__WEBPACK_IMPORTED_MODULE_15__["default"])(useVirtual, isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight, !!scrollWidth, onWheelDelta), _useFrameWheel2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_4__["default"])(_useFrameWheel, 2), onRawWheel = _useFrameWheel2[0], onFireFoxScroll = _useFrameWheel2[1]; // Mobile touch move (0,_hooks_useMobileTouchMove__WEBPACK_IMPORTED_MODULE_18__["default"])(useVirtual, componentRef, function (isHorizontal, delta, smoothOffset, e) { var event = e; if (originScroll(isHorizontal, delta, smoothOffset)) { return false; } // Fix nest List trigger TouchMove event if (!event || !event._virtualHandled) { if (event) { event._virtualHandled = true; } onRawWheel({ preventDefault: function preventDefault() {}, deltaX: isHorizontal ? delta : 0, deltaY: isHorizontal ? 0 : delta }); return true; } return false; }); // MouseDown drag for scroll (0,_hooks_useScrollDrag__WEBPACK_IMPORTED_MODULE_20__["default"])(inVirtual, componentRef, function (offset) { syncScrollTop(function (top) { return top + offset; }); }); (0,rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_9__["default"])(function () { // Firefox only function onMozMousePixelScroll(e) { // scrolling at top/bottom limit var scrollingUpAtTop = isScrollAtTop && e.detail < 0; var scrollingDownAtBottom = isScrollAtBottom && e.detail > 0; if (useVirtual && !scrollingUpAtTop && !scrollingDownAtBottom) { e.preventDefault(); } } var componentEle = componentRef.current; componentEle.addEventListener('wheel', onRawWheel, { passive: false }); componentEle.addEventListener('DOMMouseScroll', onFireFoxScroll, { passive: true }); componentEle.addEventListener('MozMousePixelScroll', onMozMousePixelScroll, { passive: false }); return function () { componentEle.removeEventListener('wheel', onRawWheel); componentEle.removeEventListener('DOMMouseScroll', onFireFoxScroll); componentEle.removeEventListener('MozMousePixelScroll', onMozMousePixelScroll); }; }, [useVirtual, isScrollAtTop, isScrollAtBottom]); // Sync scroll left (0,rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_9__["default"])(function () { if (scrollWidth) { var newOffsetLeft = keepInHorizontalRange(offsetLeft); setOffsetLeft(newOffsetLeft); triggerScroll({ x: newOffsetLeft }); } }, [size.width, scrollWidth]); // ================================= Ref ================================== var delayHideScrollBar = function delayHideScrollBar() { var _verticalScrollBarRef, _horizontalScrollBarR; (_verticalScrollBarRef = verticalScrollBarRef.current) === null || _verticalScrollBarRef === void 0 || _verticalScrollBarRef.delayHidden(); (_horizontalScrollBarR = horizontalScrollBarRef.current) === null || _horizontalScrollBarR === void 0 || _horizontalScrollBarR.delayHidden(); }; var _scrollTo = (0,_hooks_useScrollTo__WEBPACK_IMPORTED_MODULE_21__["default"])(componentRef, mergedData, heights, itemHeight, getKey, function () { return collectHeight(true); }, syncScrollTop, delayHideScrollBar); react__WEBPACK_IMPORTED_MODULE_10__.useImperativeHandle(ref, function () { return { nativeElement: containerRef.current, getScrollInfo: getVirtualScrollInfo, scrollTo: function scrollTo(config) { function isPosScroll(arg) { return arg && (0,_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_1__["default"])(arg) === 'object' && ('left' in arg || 'top' in arg); } if (isPosScroll(config)) { // Scroll X if (config.left !== undefined) { setOffsetLeft(keepInHorizontalRange(config.left)); } // Scroll Y _scrollTo(config.top); } else { _scrollTo(config); } } }; }); // ================================ Effect ================================ /** We need told outside that some list not rendered */ (0,rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_9__["default"])(function () { if (onVisibleChange) { var renderList = mergedData.slice(start, end + 1); onVisibleChange(renderList, mergedData); } }, [start, end, mergedData]); // ================================ Extra ================================= var getSize = (0,_hooks_useGetSize__WEBPACK_IMPORTED_MODULE_16__.useGetSize)(mergedData, getKey, heights, itemHeight); var extraContent = extraRender === null || extraRender === void 0 ? void 0 : extraRender({ start: start, end: end, virtual: inVirtual, offsetX: offsetLeft, offsetY: fillerOffset, rtl: isRTL, getSize: getSize }); // ================================ Render ================================ var listChildren = (0,_hooks_useChildren__WEBPACK_IMPORTED_MODULE_13__["default"])(mergedData, start, end, scrollWidth, offsetLeft, setInstanceRef, children, sharedConfig); var componentStyle = null; if (height) { componentStyle = (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__["default"])((0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_3__["default"])({}, fullHeight ? 'height' : 'maxHeight', height), ScrollStyle); if (useVirtual) { componentStyle.overflowY = 'hidden'; if (scrollWidth) { componentStyle.overflowX = 'hidden'; } if (scrollMoving) { componentStyle.pointerEvents = 'none'; } } } var containerProps = {}; if (isRTL) { containerProps.dir = 'rtl'; } return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_10__.createElement("div", (0,_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__["default"])({ ref: containerRef, style: (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_2__["default"])({}, style), {}, { position: 'relative' }), className: mergedClassName }, containerProps, restProps), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_10__.createElement(rc_resize_observer__WEBPACK_IMPORTED_MODULE_7__["default"], { onResize: onHolderResize }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_10__.createElement(Component, { className: "".concat(prefixCls, "-holder"), style: componentStyle, ref: componentRef, onScroll: onFallbackScroll, onMouseEnter: delayHideScrollBar }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_10__.createElement(_Filler__WEBPACK_IMPORTED_MODULE_12__["default"], { prefixCls: prefixCls, height: scrollHeight, offsetX: offsetLeft, offsetY: fillerOffset, scrollWidth: scrollWidth, onInnerResize: collectHeight, ref: fillerInnerRef, innerProps: innerProps, rtl: isRTL, extra: extraContent }, listChildren))), inVirtual && scrollHeight > height && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_10__.createElement(_ScrollBar__WEBPACK_IMPORTED_MODULE_22__["default"], { ref: verticalScrollBarRef, prefixCls: prefixCls, scrollOffset: offsetTop, scrollRange: scrollHeight, rtl: isRTL, onScroll: onScrollBar, onStartMove: onScrollbarStartMove, onStopMove: onScrollbarStopMove, spinSize: verticalScrollBarSpinSize, containerSize: size.height, style: styles === null || styles === void 0 ? void 0 : styles.verticalScrollBar, thumbStyle: styles === null || styles === void 0 ? void 0 : styles.verticalScrollBarThumb, showScrollBar: showScrollBar }), inVirtual && scrollWidth > size.width && /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_10__.createElement(_ScrollBar__WEBPACK_IMPORTED_MODULE_22__["default"], { ref: horizontalScrollBarRef, prefixCls: prefixCls, scrollOffset: offsetLeft, scrollRange: scrollWidth, rtl: isRTL, onScroll: onScrollBar, onStartMove: onScrollbarStartMove, onStopMove: onScrollbarStopMove, spinSize: horizontalScrollBarSpinSize, containerSize: size.width, horizontal: true, style: styles === null || styles === void 0 ? void 0 : styles.horizontalScrollBar, thumbStyle: styles === null || styles === void 0 ? void 0 : styles.horizontalScrollBarThumb, showScrollBar: showScrollBar })); } var List = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_10__.forwardRef(RawList); List.displayName = 'List'; /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (List); /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/ScrollBar.js": /*!*************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/ScrollBar.js ***! \*************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "../../../node_modules/@babel/runtime/helpers/esm/objectSpread2.js"); /* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ "../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"); /* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "../../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js"); /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! classnames */ "../../../node_modules/classnames/index.js"); /* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var rc_util_es_raf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rc-util/es/raf */ "../../../node_modules/rc-util/es/raf.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_5__); /* harmony import */ var _hooks_useScrollDrag__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./hooks/useScrollDrag */ "../../../node_modules/rc-virtual-list/es/hooks/useScrollDrag.js"); var ScrollBar = /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5__.forwardRef(function (props, ref) { var prefixCls = props.prefixCls, rtl = props.rtl, scrollOffset = props.scrollOffset, scrollRange = props.scrollRange, onStartMove = props.onStartMove, onStopMove = props.onStopMove, onScroll = props.onScroll, horizontal = props.horizontal, spinSize = props.spinSize, containerSize = props.containerSize, style = props.style, propsThumbStyle = props.thumbStyle, showScrollBar = props.showScrollBar; var _React$useState = react__WEBPACK_IMPORTED_MODULE_5__.useState(false), _React$useState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_2__["default"])(_React$useState, 2), dragging = _React$useState2[0], setDragging = _React$useState2[1]; var _React$useState3 = react__WEBPACK_IMPORTED_MODULE_5__.useState(null), _React$useState4 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_2__["default"])(_React$useState3, 2), pageXY = _React$useState4[0], setPageXY = _React$useState4[1]; var _React$useState5 = react__WEBPACK_IMPORTED_MODULE_5__.useState(null), _React$useState6 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_2__["default"])(_React$useState5, 2), startTop = _React$useState6[0], setStartTop = _React$useState6[1]; var isLTR = !rtl; // ========================= Refs ========================= var scrollbarRef = react__WEBPACK_IMPORTED_MODULE_5__.useRef(); var thumbRef = react__WEBPACK_IMPORTED_MODULE_5__.useRef(); // ======================= Visible ======================== var _React$useState7 = react__WEBPACK_IMPORTED_MODULE_5__.useState(showScrollBar), _React$useState8 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_2__["default"])(_React$useState7, 2), visible = _React$useState8[0], setVisible = _React$useState8[1]; var visibleTimeoutRef = react__WEBPACK_IMPORTED_MODULE_5__.useRef(); var delayHidden = function delayHidden() { if (showScrollBar === true || showScrollBar === false) return; clearTimeout(visibleTimeoutRef.current); setVisible(true); visibleTimeoutRef.current = setTimeout(function () { setVisible(false); }, 3000); }; // ======================== Range ========================= var enableScrollRange = scrollRange - containerSize || 0; var enableOffsetRange = containerSize - spinSize || 0; // ========================= Top ========================== var top = react__WEBPACK_IMPORTED_MODULE_5__.useMemo(function () { if (scrollOffset === 0 || enableScrollRange === 0) { return 0; } var ptg = scrollOffset / enableScrollRange; return ptg * enableOffsetRange; }, [scrollOffset, enableScrollRange, enableOffsetRange]); // ====================== Container ======================= var onContainerMouseDown = function onContainerMouseDown(e) { e.stopPropagation(); e.preventDefault(); }; // ======================== Thumb ========================= var stateRef = react__WEBPACK_IMPORTED_MODULE_5__.useRef({ top: top, dragging: dragging, pageY: pageXY, startTop: startTop }); stateRef.current = { top: top, dragging: dragging, pageY: pageXY, startTop: startTop }; var onThumbMouseDown = function onThumbMouseDown(e) { setDragging(true); setPageXY((0,_hooks_useScrollDrag__WEBPACK_IMPORTED_MODULE_6__.getPageXY)(e, horizontal)); setStartTop(stateRef.current.top); onStartMove(); e.stopPropagation(); e.preventDefault(); }; // ======================== Effect ======================== // React make event as passive, but we need to preventDefault // Add event on dom directly instead. // ref: https://github.com/facebook/react/issues/9809 react__WEBPACK_IMPORTED_MODULE_5__.useEffect(function () { var onScrollbarTouchStart = function onScrollbarTouchStart(e) { e.preventDefault(); }; var scrollbarEle = scrollbarRef.current; var thumbEle = thumbRef.current; scrollbarEle.addEventListener('touchstart', onScrollbarTouchStart, { passive: false }); thumbEle.addEventListener('touchstart', onThumbMouseDown, { passive: false }); return function () { scrollbarEle.removeEventListener('touchstart', onScrollbarTouchStart); thumbEle.removeEventListener('touchstart', onThumbMouseDown); }; }, []); // Pass to effect var enableScrollRangeRef = react__WEBPACK_IMPORTED_MODULE_5__.useRef(); enableScrollRangeRef.current = enableScrollRange; var enableOffsetRangeRef = react__WEBPACK_IMPORTED_MODULE_5__.useRef(); enableOffsetRangeRef.current = enableOffsetRange; react__WEBPACK_IMPORTED_MODULE_5__.useEffect(function () { if (dragging) { var moveRafId; var onMouseMove = function onMouseMove(e) { var _stateRef$current = stateRef.current, stateDragging = _stateRef$current.dragging, statePageY = _stateRef$current.pageY, stateStartTop = _stateRef$current.startTop; rc_util_es_raf__WEBPACK_IMPORTED_MODULE_4__["default"].cancel(moveRafId); var rect = scrollbarRef.current.getBoundingClientRect(); var scale = containerSize / (horizontal ? rect.width : rect.height); if (stateDragging) { var offset = ((0,_hooks_useScrollDrag__WEBPACK_IMPORTED_MODULE_6__.getPageXY)(e, horizontal) - statePageY) * scale; var newTop = stateStartTop; if (!isLTR && horizontal) { newTop -= offset; } else { newTop += offset; } var tmpEnableScrollRange = enableScrollRangeRef.current; var tmpEnableOffsetRange = enableOffsetRangeRef.current; var ptg = tmpEnableOffsetRange ? newTop / tmpEnableOffsetRange : 0; var newScrollTop = Math.ceil(ptg * tmpEnableScrollRange); newScrollTop = Math.max(newScrollTop, 0); newScrollTop = Math.min(newScrollTop, tmpEnableScrollRange); moveRafId = (0,rc_util_es_raf__WEBPACK_IMPORTED_MODULE_4__["default"])(function () { onScroll(newScrollTop, horizontal); }); } }; var onMouseUp = function onMouseUp() { setDragging(false); onStopMove(); }; window.addEventListener('mousemove', onMouseMove, { passive: true }); window.addEventListener('touchmove', onMouseMove, { passive: true }); window.addEventListener('mouseup', onMouseUp, { passive: true }); window.addEventListener('touchend', onMouseUp, { passive: true }); return function () { window.removeEventListener('mousemove', onMouseMove); window.removeEventListener('touchmove', onMouseMove); window.removeEventListener('mouseup', onMouseUp); window.removeEventListener('touchend', onMouseUp); rc_util_es_raf__WEBPACK_IMPORTED_MODULE_4__["default"].cancel(moveRafId); }; } }, [dragging]); react__WEBPACK_IMPORTED_MODULE_5__.useEffect(function () { delayHidden(); return function () { clearTimeout(visibleTimeoutRef.current); }; }, [scrollOffset]); // ====================== Imperative ====================== react__WEBPACK_IMPORTED_MODULE_5__.useImperativeHandle(ref, function () { return { delayHidden: delayHidden }; }); // ======================== Render ======================== var scrollbarPrefixCls = "".concat(prefixCls, "-scrollbar"); var containerStyle = { position: 'absolute', visibility: visible ? null : 'hidden' }; var thumbStyle = { position: 'absolute', borderRadius: 99, background: 'var(--rc-virtual-list-scrollbar-bg, rgba(0, 0, 0, 0.5))', cursor: 'pointer', userSelect: 'none' }; if (horizontal) { Object.assign(containerStyle, { height: 8, left: 0, right: 0, bottom: 0 }); Object.assign(thumbStyle, (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])({ height: '100%', width: spinSize }, isLTR ? 'left' : 'right', top)); } else { Object.assign(containerStyle, (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])({ width: 8, top: 0, bottom: 0 }, isLTR ? 'right' : 'left', 0)); Object.assign(thumbStyle, { width: '100%', height: spinSize, top: top }); } return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5__.createElement("div", { ref: scrollbarRef, className: classnames__WEBPACK_IMPORTED_MODULE_3___default()(scrollbarPrefixCls, (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])({}, "".concat(scrollbarPrefixCls, "-horizontal"), horizontal), "".concat(scrollbarPrefixCls, "-vertical"), !horizontal), "".concat(scrollbarPrefixCls, "-visible"), visible)), style: (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, containerStyle), style), onMouseDown: onContainerMouseDown, onMouseMove: delayHidden }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_5__.createElement("div", { ref: thumbRef, className: classnames__WEBPACK_IMPORTED_MODULE_3___default()("".concat(scrollbarPrefixCls, "-thumb"), (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_1__["default"])({}, "".concat(scrollbarPrefixCls, "-thumb-moving"), dragging)), style: (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_0__["default"])({}, thumbStyle), propsThumbStyle), onMouseDown: onThumbMouseDown })); }); if (true) { ScrollBar.displayName = 'ScrollBar'; } /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ScrollBar); /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/hooks/useChildren.js": /*!*********************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/hooks/useChildren.js ***! \*********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ useChildren) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _Item__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Item */ "../../../node_modules/rc-virtual-list/es/Item.js"); function useChildren(list, startIndex, endIndex, scrollWidth, offsetX, setNodeRef, renderFunc, _ref) { var getKey = _ref.getKey; return list.slice(startIndex, endIndex + 1).map(function (item, index) { var eleIndex = startIndex + index; var node = renderFunc(item, eleIndex, { style: { width: scrollWidth }, offsetX: offsetX }); var key = getKey(item); return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_Item__WEBPACK_IMPORTED_MODULE_1__.Item, { key: key, setRef: function setRef(ele) { return setNodeRef(item, ele); } }, node); }); } /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/hooks/useDiffItem.js": /*!*********************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/hooks/useDiffItem.js ***! \*********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ useDiffItem) /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "../../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _utils_algorithmUtil__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/algorithmUtil */ "../../../node_modules/rc-virtual-list/es/utils/algorithmUtil.js"); function useDiffItem(data, getKey, onDiff) { var _React$useState = react__WEBPACK_IMPORTED_MODULE_1__.useState(data), _React$useState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__["default"])(_React$useState, 2), prevData = _React$useState2[0], setPrevData = _React$useState2[1]; var _React$useState3 = react__WEBPACK_IMPORTED_MODULE_1__.useState(null), _React$useState4 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__["default"])(_React$useState3, 2), diffItem = _React$useState4[0], setDiffItem = _React$useState4[1]; react__WEBPACK_IMPORTED_MODULE_1__.useEffect(function () { var diff = (0,_utils_algorithmUtil__WEBPACK_IMPORTED_MODULE_2__.findListDiffIndex)(prevData || [], data || [], getKey); if ((diff === null || diff === void 0 ? void 0 : diff.index) !== undefined) { onDiff === null || onDiff === void 0 || onDiff(diff.index); setDiffItem(data[diff.index]); } setPrevData(data); }, [data]); return [diffItem]; } /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/hooks/useFrameWheel.js": /*!***********************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/hooks/useFrameWheel.js ***! \***********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ useFrameWheel) /* harmony export */ }); /* harmony import */ var rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rc-util/es/raf */ "../../../node_modules/rc-util/es/raf.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _utils_isFirefox__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/isFirefox */ "../../../node_modules/rc-virtual-list/es/utils/isFirefox.js"); /* harmony import */ var _useOriginScroll__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./useOriginScroll */ "../../../node_modules/rc-virtual-list/es/hooks/useOriginScroll.js"); function useFrameWheel(inVirtual, isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight, horizontalScroll, /*** * Return `true` when you need to prevent default event */ onWheelDelta) { var offsetRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(0); var nextFrameRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null); // Firefox patch var wheelValueRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null); var isMouseScrollRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(false); // Scroll status sync var originScroll = (0,_useOriginScroll__WEBPACK_IMPORTED_MODULE_3__["default"])(isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight); function onWheelY(e, deltaY) { rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__["default"].cancel(nextFrameRef.current); // Do nothing when scroll at the edge, Skip check when is in scroll if (originScroll(false, deltaY)) return; // Skip if nest List has handled this event var event = e; if (!event._virtualHandled) { event._virtualHandled = true; } else { return; } offsetRef.current += deltaY; wheelValueRef.current = deltaY; // Proxy of scroll events if (!_utils_isFirefox__WEBPACK_IMPORTED_MODULE_2__["default"]) { event.preventDefault(); } nextFrameRef.current = (0,rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__["default"])(function () { // Patch a multiple for Firefox to fix wheel number too small // ref: https://github.com/ant-design/ant-design/issues/26372#issuecomment-679460266 var patchMultiple = isMouseScrollRef.current ? 10 : 1; onWheelDelta(offsetRef.current * patchMultiple, false); offsetRef.current = 0; }); } function onWheelX(event, deltaX) { onWheelDelta(deltaX, true); if (!_utils_isFirefox__WEBPACK_IMPORTED_MODULE_2__["default"]) { event.preventDefault(); } } // Check for which direction does wheel do. `sx` means `shift + wheel` var wheelDirectionRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null); var wheelDirectionCleanRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null); function onWheel(event) { if (!inVirtual) return; // Wait for 2 frame to clean direction rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__["default"].cancel(wheelDirectionCleanRef.current); wheelDirectionCleanRef.current = (0,rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__["default"])(function () { wheelDirectionRef.current = null; }, 2); var deltaX = event.deltaX, deltaY = event.deltaY, shiftKey = event.shiftKey; var mergedDeltaX = deltaX; var mergedDeltaY = deltaY; if (wheelDirectionRef.current === 'sx' || !wheelDirectionRef.current && (shiftKey || false) && deltaY && !deltaX) { mergedDeltaX = deltaY; mergedDeltaY = 0; wheelDirectionRef.current = 'sx'; } var absX = Math.abs(mergedDeltaX); var absY = Math.abs(mergedDeltaY); if (wheelDirectionRef.current === null) { wheelDirectionRef.current = horizontalScroll && absX > absY ? 'x' : 'y'; } if (wheelDirectionRef.current === 'y') { onWheelY(event, mergedDeltaY); } else { onWheelX(event, mergedDeltaX); } } // A patch for firefox function onFireFoxScroll(event) { if (!inVirtual) return; isMouseScrollRef.current = event.detail === wheelValueRef.current; } return [onWheel, onFireFoxScroll]; } /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/hooks/useGetSize.js": /*!********************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/hooks/useGetSize.js ***! \********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ useGetSize: () => (/* binding */ useGetSize) /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "../../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); /** * Size info need loop query for the `heights` which will has the perf issue. * Let cache result for each render phase. */ function useGetSize(mergedData, getKey, heights, itemHeight) { var _React$useMemo = react__WEBPACK_IMPORTED_MODULE_1__.useMemo(function () { return [new Map(), []]; }, [mergedData, heights.id, itemHeight]), _React$useMemo2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__["default"])(_React$useMemo, 2), key2Index = _React$useMemo2[0], bottomList = _React$useMemo2[1]; var getSize = function getSize(startKey) { var endKey = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : startKey; // Get from cache first var startIndex = key2Index.get(startKey); var endIndex = key2Index.get(endKey); // Loop to fill the cache if (startIndex === undefined || endIndex === undefined) { var dataLen = mergedData.length; for (var i = bottomList.length; i < dataLen; i += 1) { var _heights$get; var item = mergedData[i]; var key = getKey(item); key2Index.set(key, i); var cacheHeight = (_heights$get = heights.get(key)) !== null && _heights$get !== void 0 ? _heights$get : itemHeight; bottomList[i] = (bottomList[i - 1] || 0) + cacheHeight; if (key === startKey) { startIndex = i; } if (key === endKey) { endIndex = i; } if (startIndex !== undefined && endIndex !== undefined) { break; } } } return { top: bottomList[startIndex - 1] || 0, bottom: bottomList[endIndex] }; }; return getSize; } /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/hooks/useHeights.js": /*!********************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/hooks/useHeights.js ***! \********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ useHeights) /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "../../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _utils_CacheMap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/CacheMap */ "../../../node_modules/rc-virtual-list/es/utils/CacheMap.js"); function parseNumber(value) { var num = parseFloat(value); return isNaN(num) ? 0 : num; } function useHeights(getKey, onItemAdd, onItemRemove) { var _React$useState = react__WEBPACK_IMPORTED_MODULE_1__.useState(0), _React$useState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_0__["default"])(_React$useState, 2), updatedMark = _React$useState2[0], setUpdatedMark = _React$useState2[1]; var instanceRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(new Map()); var heightsRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(new _utils_CacheMap__WEBPACK_IMPORTED_MODULE_2__["default"]()); var promiseIdRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(0); function cancelRaf() { promiseIdRef.current += 1; } function collectHeight() { var sync = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; cancelRaf(); var doCollect = function doCollect() { var changed = false; instanceRef.current.forEach(function (element, key) { if (element && element.offsetParent) { var offsetHeight = element.offsetHeight; var _getComputedStyle = getComputedStyle(element), marginTop = _getComputedStyle.marginTop, marginBottom = _getComputedStyle.marginBottom; var marginTopNum = parseNumber(marginTop); var marginBottomNum = parseNumber(marginBottom); var totalHeight = offsetHeight + marginTopNum + marginBottomNum; if (heightsRef.current.get(key) !== totalHeight) { heightsRef.current.set(key, totalHeight); changed = true; } } }); // Always trigger update mark to tell parent that should re-calculate heights when resized if (changed) { setUpdatedMark(function (c) { return c + 1; }); } }; if (sync) { doCollect(); } else { promiseIdRef.current += 1; var id = promiseIdRef.current; Promise.resolve().then(function () { if (id === promiseIdRef.current) { doCollect(); } }); } } function setInstanceRef(item, instance) { var key = getKey(item); var origin = instanceRef.current.get(key); if (instance) { instanceRef.current.set(key, instance); collectHeight(); } else { instanceRef.current.delete(key); } // Instance changed if (!origin !== !instance) { if (instance) { onItemAdd === null || onItemAdd === void 0 || onItemAdd(item); } else { onItemRemove === null || onItemRemove === void 0 || onItemRemove(item); } } } (0,react__WEBPACK_IMPORTED_MODULE_1__.useEffect)(function () { return cancelRaf; }, []); return [setInstanceRef, collectHeight, heightsRef.current, updatedMark]; } /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js": /*!****************************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/hooks/useMobileTouchMove.js ***! \****************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ useMobileTouchMove) /* harmony export */ }); /* harmony import */ var rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rc-util/es/hooks/useLayoutEffect */ "../../../node_modules/rc-util/es/hooks/useLayoutEffect.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); var SMOOTH_PTG = 14 / 15; function useMobileTouchMove(inVirtual, listRef, callback) { var touchedRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(false); var touchXRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(0); var touchYRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(0); var elementRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null); // Smooth scroll var intervalRef = (0,react__WEBPACK_IMPORTED_MODULE_1__.useRef)(null); /* eslint-disable prefer-const */ var cleanUpEvents; var onTouchMove = function onTouchMove(e) { if (touchedRef.current) { var currentX = Math.ceil(e.touches[0].pageX); var currentY = Math.ceil(e.touches[0].pageY); var offsetX = touchXRef.current - currentX; var offsetY = touchYRef.current - currentY; var _isHorizontal = Math.abs(offsetX) > Math.abs(offsetY); if (_isHorizontal) { touchXRef.current = currentX; } else { touchYRef.current = currentY; } var scrollHandled = callback(_isHorizontal, _isHorizontal ? offsetX : offsetY, false, e); if (scrollHandled) { e.preventDefault(); } // Smooth interval clearInterval(intervalRef.current); if (scrollHandled) { intervalRef.current = setInterval(function () { if (_isHorizontal) { offsetX *= SMOOTH_PTG; } else { offsetY *= SMOOTH_PTG; } var offset = Math.floor(_isHorizontal ? offsetX : offsetY); if (!callback(_isHorizontal, offset, true) || Math.abs(offset) <= 0.1) { clearInterval(intervalRef.current); } }, 16); } } }; var onTouchEnd = function onTouchEnd() { touchedRef.current = false; cleanUpEvents(); }; var onTouchStart = function onTouchStart(e) { cleanUpEvents(); if (e.touches.length === 1 && !touchedRef.current) { touchedRef.current = true; touchXRef.current = Math.ceil(e.touches[0].pageX); touchYRef.current = Math.ceil(e.touches[0].pageY); elementRef.current = e.target; elementRef.current.addEventListener('touchmove', onTouchMove, { passive: false }); elementRef.current.addEventListener('touchend', onTouchEnd, { passive: true }); } }; cleanUpEvents = function cleanUpEvents() { if (elementRef.current) { elementRef.current.removeEventListener('touchmove', onTouchMove); elementRef.current.removeEventListener('touchend', onTouchEnd); } }; (0,rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_0__["default"])(function () { if (inVirtual) { listRef.current.addEventListener('touchstart', onTouchStart, { passive: true }); } return function () { var _listRef$current; (_listRef$current = listRef.current) === null || _listRef$current === void 0 || _listRef$current.removeEventListener('touchstart', onTouchStart); cleanUpEvents(); clearInterval(intervalRef.current); }; }, [inVirtual]); } /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/hooks/useOriginScroll.js": /*!*************************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/hooks/useOriginScroll.js ***! \*************************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (function (isScrollAtTop, isScrollAtBottom, isScrollAtLeft, isScrollAtRight) { // Do lock for a wheel when scrolling var lockRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false); var lockTimeoutRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(null); function lockScroll() { clearTimeout(lockTimeoutRef.current); lockRef.current = true; lockTimeoutRef.current = setTimeout(function () { lockRef.current = false; }, 50); } // Pass to ref since global add is in closure var scrollPingRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)({ top: isScrollAtTop, bottom: isScrollAtBottom, left: isScrollAtLeft, right: isScrollAtRight }); scrollPingRef.current.top = isScrollAtTop; scrollPingRef.current.bottom = isScrollAtBottom; scrollPingRef.current.left = isScrollAtLeft; scrollPingRef.current.right = isScrollAtRight; return function (isHorizontal, delta) { var smoothOffset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; var originScroll = isHorizontal ? // Pass origin wheel when on the left delta < 0 && scrollPingRef.current.left || // Pass origin wheel when on the right delta > 0 && scrollPingRef.current.right // Pass origin wheel when on the top : delta < 0 && scrollPingRef.current.top || // Pass origin wheel when on the bottom delta > 0 && scrollPingRef.current.bottom; if (smoothOffset && originScroll) { // No need lock anymore when it's smooth offset from touchMove interval clearTimeout(lockTimeoutRef.current); lockRef.current = false; } else if (!originScroll || lockRef.current) { lockScroll(); } return !lockRef.current && originScroll; }; }); /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/hooks/useScrollDrag.js": /*!***********************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/hooks/useScrollDrag.js ***! \***********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ useScrollDrag), /* harmony export */ getPageXY: () => (/* binding */ getPageXY) /* harmony export */ }); /* harmony import */ var rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rc-util/es/raf */ "../../../node_modules/rc-util/es/raf.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_1__); function smoothScrollOffset(offset) { return Math.floor(Math.pow(offset, 0.5)); } function getPageXY(e, horizontal) { var obj = 'touches' in e ? e.touches[0] : e; return obj[horizontal ? 'pageX' : 'pageY'] - window[horizontal ? 'scrollX' : 'scrollY']; } function useScrollDrag(inVirtual, componentRef, onScrollOffset) { react__WEBPACK_IMPORTED_MODULE_1__.useEffect(function () { var ele = componentRef.current; if (inVirtual && ele) { var mouseDownLock = false; var rafId; var _offset; var stopScroll = function stopScroll() { rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__["default"].cancel(rafId); }; var continueScroll = function continueScroll() { stopScroll(); rafId = (0,rc_util_es_raf__WEBPACK_IMPORTED_MODULE_0__["default"])(function () { onScrollOffset(_offset); continueScroll(); }); }; var clearDragState = function clearDragState() { mouseDownLock = false; stopScroll(); }; var onMouseDown = function onMouseDown(e) { // Skip if element set draggable if (e.target.draggable || e.button !== 0) { return; } // Skip if nest List has handled this event var event = e; if (!event._virtualHandled) { event._virtualHandled = true; mouseDownLock = true; } }; var onMouseMove = function onMouseMove(e) { if (mouseDownLock) { var mouseY = getPageXY(e, false); var _ele$getBoundingClien = ele.getBoundingClientRect(), top = _ele$getBoundingClien.top, bottom = _ele$getBoundingClien.bottom; if (mouseY <= top) { var diff = top - mouseY; _offset = -smoothScrollOffset(diff); continueScroll(); } else if (mouseY >= bottom) { var _diff = mouseY - bottom; _offset = smoothScrollOffset(_diff); continueScroll(); } else { stopScroll(); } } }; ele.addEventListener('mousedown', onMouseDown); ele.ownerDocument.addEventListener('mouseup', clearDragState); ele.ownerDocument.addEventListener('mousemove', onMouseMove); ele.ownerDocument.addEventListener('dragend', clearDragState); return function () { ele.removeEventListener('mousedown', onMouseDown); ele.ownerDocument.removeEventListener('mouseup', clearDragState); ele.ownerDocument.removeEventListener('mousemove', onMouseMove); ele.ownerDocument.removeEventListener('dragend', clearDragState); stopScroll(); }; } }, [inVirtual]); } /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/hooks/useScrollTo.js": /*!*********************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/hooks/useScrollTo.js ***! \*********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (/* binding */ useScrollTo) /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/typeof */ "../../../node_modules/@babel/runtime/helpers/esm/typeof.js"); /* harmony import */ var _babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/objectSpread2 */ "../../../node_modules/@babel/runtime/helpers/esm/objectSpread2.js"); /* harmony import */ var _babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/slicedToArray */ "../../../node_modules/@babel/runtime/helpers/esm/slicedToArray.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js"); /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var rc_util_es_raf__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! rc-util/es/raf */ "../../../node_modules/rc-util/es/raf.js"); /* harmony import */ var rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! rc-util/es/hooks/useLayoutEffect */ "../../../node_modules/rc-util/es/hooks/useLayoutEffect.js"); /* harmony import */ var rc_util__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! rc-util */ "../../../node_modules/rc-util/es/index.js"); /* eslint-disable no-param-reassign */ var MAX_TIMES = 10; function useScrollTo(containerRef, data, heights, itemHeight, getKey, collectHeight, syncScrollTop, triggerFlash) { var scrollRef = react__WEBPACK_IMPORTED_MODULE_3__.useRef(); var _React$useState = react__WEBPACK_IMPORTED_MODULE_3__.useState(null), _React$useState2 = (0,_babel_runtime_helpers_esm_slicedToArray__WEBPACK_IMPORTED_MODULE_2__["default"])(_React$useState, 2), syncState = _React$useState2[0], setSyncState = _React$useState2[1]; // ========================== Sync Scroll ========================== (0,rc_util_es_hooks_useLayoutEffect__WEBPACK_IMPORTED_MODULE_5__["default"])(function () { if (syncState && syncState.times < MAX_TIMES) { // Never reach if (!containerRef.current) { setSyncState(function (ori) { return (0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({}, ori); }); return; } collectHeight(); var targetAlign = syncState.targetAlign, originAlign = syncState.originAlign, index = syncState.index, offset = syncState.offset; var height = containerRef.current.clientHeight; var needCollectHeight = false; var newTargetAlign = targetAlign; var targetTop = null; // Go to next frame if height not exist if (height) { var mergedAlign = targetAlign || originAlign; // Get top & bottom var stackTop = 0; var itemTop = 0; var itemBottom = 0; var maxLen = Math.min(data.length - 1, index); for (var i = 0; i <= maxLen; i += 1) { var key = getKey(data[i]); itemTop = stackTop; var cacheHeight = heights.get(key); itemBottom = itemTop + (cacheHeight === undefined ? itemHeight : cacheHeight); stackTop = itemBottom; } // Check if need sync height (visible range has item not record height) var leftHeight = mergedAlign === 'top' ? offset : height - offset; for (var _i = maxLen; _i >= 0; _i -= 1) { var _key = getKey(data[_i]); var _cacheHeight = heights.get(_key); if (_cacheHeight === undefined) { needCollectHeight = true; break; } leftHeight -= _cacheHeight; if (leftHeight <= 0) { break; } } // Scroll to switch (mergedAlign) { case 'top': targetTop = itemTop - offset; break; case 'bottom': targetTop = itemBottom - height + offset; break; default: { var scrollTop = containerRef.current.scrollTop; var scrollBottom = scrollTop + height; if (itemTop < scrollTop) { newTargetAlign = 'top'; } else if (itemBottom > scrollBottom) { newTargetAlign = 'bottom'; } } } if (targetTop !== null) { syncScrollTop(targetTop); } // One more time for sync if (targetTop !== syncState.lastTop) { needCollectHeight = true; } } // Trigger next effect if (needCollectHeight) { setSyncState((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])((0,_babel_runtime_helpers_esm_objectSpread2__WEBPACK_IMPORTED_MODULE_1__["default"])({}, syncState), {}, { times: syncState.times + 1, targetAlign: newTargetAlign, lastTop: targetTop })); } } else if ( true && (syncState === null || syncState === void 0 ? void 0 : syncState.times) === MAX_TIMES) { (0,rc_util__WEBPACK_IMPORTED_MODULE_6__.warning)(false, 'Seems `scrollTo` with `rc-virtual-list` reach the max limitation. Please fire issue for us. Thanks.'); } }, [syncState, containerRef.current]); // =========================== Scroll To =========================== return function (arg) { // When not argument provided, we think dev may want to show the scrollbar if (arg === null || arg === undefined) { triggerFlash(); return; } // Normal scroll logic rc_util_es_raf__WEBPACK_IMPORTED_MODULE_4__["default"].cancel(scrollRef.current); if (typeof arg === 'number') { syncScrollTop(arg); } else if (arg && (0,_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(arg) === 'object') { var index; var align = arg.align; if ('index' in arg) { index = arg.index; } else { index = data.findIndex(function (item) { return getKey(item) === arg.key; }); } var _arg$offset = arg.offset, offset = _arg$offset === void 0 ? 0 : _arg$offset; setSyncState({ times: 0, index: index, offset: offset, originAlign: align }); } }; } /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/index.js": /*!*********************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/index.js ***! \*********************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _List__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./List */ "../../../node_modules/rc-virtual-list/es/List.js"); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (_List__WEBPACK_IMPORTED_MODULE_0__["default"]); /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/utils/CacheMap.js": /*!******************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/utils/CacheMap.js ***! \******************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/classCallCheck */ "../../../node_modules/@babel/runtime/helpers/esm/classCallCheck.js"); /* harmony import */ var _babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @babel/runtime/helpers/esm/createClass */ "../../../node_modules/@babel/runtime/helpers/esm/createClass.js"); /* harmony import */ var _babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @babel/runtime/helpers/esm/defineProperty */ "../../../node_modules/@babel/runtime/helpers/esm/defineProperty.js"); // Firefox has low performance of map. var CacheMap = /*#__PURE__*/function () { function CacheMap() { (0,_babel_runtime_helpers_esm_classCallCheck__WEBPACK_IMPORTED_MODULE_0__["default"])(this, CacheMap); (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_2__["default"])(this, "maps", void 0); // Used for cache key // `useMemo` no need to update if `id` not change (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_2__["default"])(this, "id", 0); (0,_babel_runtime_helpers_esm_defineProperty__WEBPACK_IMPORTED_MODULE_2__["default"])(this, "diffRecords", new Map()); this.maps = Object.create(null); } (0,_babel_runtime_helpers_esm_createClass__WEBPACK_IMPORTED_MODULE_1__["default"])(CacheMap, [{ key: "set", value: function set(key, value) { // Record prev value this.diffRecords.set(key, this.maps[key]); this.maps[key] = value; this.id += 1; } }, { key: "get", value: function get(key) { return this.maps[key]; } /** * CacheMap will record the key changed. * To help to know what's update in the next render. */ }, { key: "resetRecord", value: function resetRecord() { this.diffRecords.clear(); } }, { key: "getRecord", value: function getRecord() { return this.diffRecords; } }]); return CacheMap; }(); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CacheMap); /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/utils/algorithmUtil.js": /*!***********************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/utils/algorithmUtil.js ***! \***********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ findListDiffIndex: () => (/* binding */ findListDiffIndex), /* harmony export */ getIndexByStartLoc: () => (/* binding */ getIndexByStartLoc) /* harmony export */ }); /** * Get index with specific start index one by one. e.g. * min: 3, max: 9, start: 6 * * Return index is: * [0]: 6 * [1]: 7 * [2]: 5 * [3]: 8 * [4]: 4 * [5]: 9 * [6]: 3 */ function getIndexByStartLoc(min, max, start, index) { var beforeCount = start - min; var afterCount = max - start; var balanceCount = Math.min(beforeCount, afterCount) * 2; // Balance if (index <= balanceCount) { var stepIndex = Math.floor(index / 2); if (index % 2) { return start + stepIndex + 1; } return start - stepIndex; } // One is out of range if (beforeCount > afterCount) { return start - (index - afterCount); } return start + (index - beforeCount); } /** * We assume that 2 list has only 1 item diff and others keeping the order. * So we can use dichotomy algorithm to find changed one. */ function findListDiffIndex(originList, targetList, getKey) { var originLen = originList.length; var targetLen = targetList.length; var shortList; var longList; if (originLen === 0 && targetLen === 0) { return null; } if (originLen < targetLen) { shortList = originList; longList = targetList; } else { shortList = targetList; longList = originList; } var notExistKey = { __EMPTY_ITEM__: true }; function getItemKey(item) { if (item !== undefined) { return getKey(item); } return notExistKey; } // Loop to find diff one var diffIndex = null; var multiple = Math.abs(originLen - targetLen) !== 1; for (var i = 0; i < longList.length; i += 1) { var shortKey = getItemKey(shortList[i]); var longKey = getItemKey(longList[i]); if (shortKey !== longKey) { diffIndex = i; multiple = multiple || shortKey !== getItemKey(longList[i + 1]); break; } } return diffIndex === null ? null : { index: diffIndex, multiple: multiple }; } /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/utils/isFirefox.js": /*!*******************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/utils/isFirefox.js ***! \*******************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) /* harmony export */ }); /* harmony import */ var _babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/esm/typeof */ "../../../node_modules/@babel/runtime/helpers/esm/typeof.js"); var isFF = (typeof navigator === "undefined" ? "undefined" : (0,_babel_runtime_helpers_esm_typeof__WEBPACK_IMPORTED_MODULE_0__["default"])(navigator)) === 'object' && /Firefox/i.test(navigator.userAgent); /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (isFF); /***/ }), /***/ "../../../node_modules/rc-virtual-list/es/utils/scrollbarUtil.js": /*!***********************************************************************!*\ !*** ../../../node_modules/rc-virtual-list/es/utils/scrollbarUtil.js ***! \***********************************************************************/ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => { __webpack_require__.r(__webpack_exports__); /* harmony export */ __webpack_require__.d(__webpack_exports__, { /* harmony export */ getSpinSize: () => (/* binding */ getSpinSize) /* harmony export */ }); var MIN_SIZE = 20; function getSpinSize() { var containerSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var scrollRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var baseSize = containerSize / scrollRange * containerSize; if (isNaN(baseSize)) { baseSize = 0; } baseSize = Math.max(baseSize, MIN_SIZE); return Math.floor(baseSize); } /***/ }) }]); //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianMvdmVuZG9ycy1ub2RlX21vZHVsZXNfcmMtdmlydHVhbC1saXN0X2VzX2luZGV4X2pzLnZvbHVudGVlcmFwaS5lMDQ2NjJjMzI2MTAwMTY2YzY2OS5idW5kbGUuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQTBEO0FBQ2M7QUFDSDtBQUN0QztBQUNpQjtBQUNaO0FBQ3BDO0FBQ0E7QUFDQTtBQUNBLDBCQUEwQiw2Q0FBZ0I7QUFDMUM7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ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jdXJyZW50KTtcbiAgICBzZXRWaXNpYmxlKHRydWUpO1xuICAgIHZpc2libGVUaW1lb3V0UmVmLmN1cnJlbnQgPSBzZXRUaW1lb3V0KGZ1bmN0aW9uICgpIHtcbiAgICAgIHNldFZpc2libGUoZmFsc2UpO1xuICAgIH0sIDMwMDApO1xuICB9O1xuXG4gIC8vID09PT09PT09PT09PT09PT09PT09PT09PSBSYW5nZSA9PT09PT09PT09PT09PT09PT09PT09PT09XG4gIHZhciBlbmFibGVTY3JvbGxSYW5nZSA9IHNjcm9sbFJhbmdlIC0gY29udGFpbmVyU2l6ZSB8fCAwO1xuICB2YXIgZW5hYmxlT2Zmc2V0UmFuZ2UgPSBjb250YWluZXJTaXplIC0gc3BpblNpemUgfHwgMDtcblxuICAvLyA9PT09PT09PT09PT09PT09PT09PT09PT09IFRvcCA9PT09PT09PT09PT09PT09PT09PT09PT09PVxuICB2YXIgdG9wID0gUmVhY3QudXNlTWVtbyhmdW5jdGlvbiAoKSB7XG4gICAgaWYgKHNjcm9sbE9mZnNldCA9PT0gMCB8fCBlbmFibGVTY3JvbGxSYW5nZSA9PT0gMCkge1xuICAgICAgcmV0dXJuIDA7XG4gICAgfVxuICAgIHZhciBwdGcgPSBzY3JvbGxPZmZzZXQgLyBlbmFibGVTY3JvbGxSYW5nZTtcbiAgICByZXR1cm4gcHRnICogZW5hYmxlT2Zmc2V0UmFuZ2U7XG4gIH0sIFtzY3JvbGxPZmZzZXQsIGVuYWJsZVNjcm9sbFJhbmdlLCBlbmFibGVPZmZzZXRSYW5nZV0pO1xuXG4gIC8vID09PT09PT09PT09PT09PT09PT09PT0gQ29udGFpbmVyID09PT09PT09PT09PT09PT09PT09PT09XG4gIHZhciBvbkNvbnRhaW5lck1vdXNlRG93biA9IGZ1bmN0aW9uIG9uQ29udGFpbmVyTW91c2VEb3duKGUpIHtcbiAgICBlLnN0b3BQcm9wYWdhdGlvbigpO1xuICAgIGUucHJldmVudERlZmF1bHQoKTtcbiAgfTtcblx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m9sbCB0b1xuICAgICAgICBzd2l0Y2ggKG1lcmdlZEFsaWduKSB7XG4gICAgICAgICAgY2FzZSAndG9wJzpcbiAgICAgICAgICAgIHRhcmdldFRvcCA9IGl0ZW1Ub3AgLSBvZmZzZXQ7XG4gICAgICAgICAgICBicmVhaztcbiAgICAgICAgICBjYXNlICdib3R0b20nOlxuICAgICAgICAgICAgdGFyZ2V0VG9wID0gaXRlbUJvdHRvbSAtIGhlaWdodCArIG9mZnNldDtcbiAgICAgICAgICAgIGJyZWFrO1xuICAgICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgICB7XG4gICAgICAgICAgICAgIHZhciBzY3JvbGxUb3AgPSBjb250YWluZXJSZWYuY3VycmVudC5zY3JvbGxUb3A7XG4gICAgICAgICAgICAgIHZhciBzY3JvbGxCb3R0b20gPSBzY3JvbGxUb3AgKyBoZWlnaHQ7XG4gICAgICAgICAgICAgIGlmIChpdGVtVG9wIDwgc2Nyb2xsVG9wKSB7XG4gICAgICAgICAgICAgICAgbmV3VGFyZ2V0QWxpZ24gPSAndG9wJztcbiAgICAgICAgICAgICAgfSBlbHNlIGlmIChpdGVtQm90dG9tID4gc2Nyb2xsQm90dG9tKSB7XG4gICAgICAgICAgICAgICAgbmV3VGFyZ2V0QWxpZ24gPSAnYm90dG9tJztcbiAgICAgICAgICAgICAgfVxuICAgICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIGlmICh0YXJnZXRUb3AgIT09IG51bGwpIHtcbiAgICAgICAgICBzeW5jU2Nyb2xsVG9wKHRhcmdldFRvcCk7XG4gICAgICAgIH1cblxuICAgICAgICAvLyBPbmUgbW9yZSB0aW1lIGZvciBzeW5jXG4gICAgICAgIGlmICh0YXJnZXRUb3AgIT09IHN5bmNTdGF0ZS5sYXN0VG9wKSB7XG4gICAgICAgICAgbmVlZENvbGxlY3RIZWlnaHQgPSB0cnVlO1xuICAgICAgICB9XG4gICAgICB9XG5cbiAgICAgIC8vIFRyaWdnZXIgbmV4dC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