1 line
56 KiB
JSON
1 line
56 KiB
JSON
|
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"prefixCls\", \"className\", \"height\", \"itemHeight\", \"fullHeight\", \"style\", \"data\", \"children\", \"itemKey\", \"virtual\", \"direction\", \"scrollWidth\", \"component\", \"onScroll\", \"onVirtualScroll\", \"onVisibleChange\", \"innerProps\", \"extraRender\", \"styles\"];\nimport classNames from 'classnames';\nimport ResizeObserver from 'rc-resize-observer';\nimport { useEvent } from 'rc-util';\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nimport * as React from 'react';\nimport { useRef, useState } from 'react';\nimport { flushSync } from 'react-dom';\nimport Filler from \"./Filler\";\nimport useChildren from \"./hooks/useChildren\";\nimport useDiffItem from \"./hooks/useDiffItem\";\nimport useFrameWheel from \"./hooks/useFrameWheel\";\nimport { useGetSize } from \"./hooks/useGetSize\";\nimport useHeights from \"./hooks/useHeights\";\nimport useMobileTouchMove from \"./hooks/useMobileTouchMove\";\nimport useOriginScroll from \"./hooks/useOriginScroll\";\nimport useScrollTo from \"./hooks/useScrollTo\";\nimport ScrollBar from \"./ScrollBar\";\nimport { getSpinSize } from \"./utils/scrollbarUtil\";\nvar EMPTY_DATA = [];\nvar ScrollStyle = {\n overflowY: 'auto',\n overflowAnchor: 'none'\n};\nexport function RawList(props, ref) {\n var _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? 'rc-virtual-list' : _props$prefixCls,\n className = props.className,\n height = props.height,\n itemHeight = props.itemHeight,\n _props$fullHeight = props.fullHeight,\n fullHeight = _props$fullHeight === void 0 ? true : _props$fullHeight,\n style = props.style,\n data = props.data,\n children = props.children,\n itemKey = props.itemKey,\n virtual = props.virtual,\n direction = props.direction,\n scrollWidth = props.scrollWidth,\n _props$component = props.component,\n Component = _props$component === void 0 ? 'div' : _props$component,\n onScroll = props.onScroll,\n onVirtualScroll = props.onVirtualScroll,\n onVisibleChange = props.onVisibleChange,\n innerProps = props.innerProps,\n extraRender = props.extraRender,\n styles = props.styles,\n restProps = _objectWithoutProperties(props, _excluded);\n\n // =============================== Item Key ===============================\n var getKey = React.useCallback(function (item) {\n if (typeof itemKey === 'function') {\n return itemKey(item);\n }\n return item === null || item === void 0 ? void 0 : item[itemKey];\n }, [itemKey]);\n\n // ================================ Height ================================\n var _useHeights = useHeights(getKey, null, null),\n _useHeights2 = _slicedToArray(_useHeights, 4),\n setInstanceRef = _useHeights2[0],\n collectHeight = _useHeights2[1],\n heights = _useHeights2[2],\n heightUpdatedMark = _useHeights2[3];\n\n // ================================= MISC =================================\n var useVirtual = !!(virtual !== false && height && itemHeight);\n var containerHeight = React.useMemo(function () {\n return Object.values(heights.maps).reduce(function (total, curr) {\n return total + curr;\n }, 0);\n }, [heights.id, heights.maps]);\n var inVirtual = useVirtual && data && (Math.max(itemHeight * data.length, containerHeight) > height || !!scrollWidth);\n var isRTL = direction === 'rtl';\n var mergedClassName = classNames(prefixCls, _defineProperty({}, \"\".concat(prefixCls, \"-rtl\"), isRTL), className);\n var mergedData = data || EMPTY_DATA;\n var componentRef = useRef();\n var fillerInnerRef = useRef();\n var c
|