1 line
37 KiB
JSON
1 line
37 KiB
JSON
|
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"prefixCls\", \"data\", \"renderItem\", \"renderRawItem\", \"itemKey\", \"itemWidth\", \"ssr\", \"style\", \"className\", \"maxCount\", \"renderRest\", \"renderRawRest\", \"suffix\", \"component\", \"itemComponent\", \"onVisibleChange\"];\nimport * as React from 'react';\nimport { useState, useMemo, useCallback } from 'react';\nimport classNames from 'classnames';\nimport ResizeObserver from 'rc-resize-observer';\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nimport Item from './Item';\nimport useEffectState, { useBatcher } from './hooks/useEffectState';\nimport RawItem from './RawItem';\nimport { OverflowContext } from './context';\nvar RESPONSIVE = 'responsive';\nvar INVALIDATE = 'invalidate';\nexport { OverflowContext } from './context';\nfunction defaultRenderRest(omittedItems) {\n return \"+ \".concat(omittedItems.length, \" ...\");\n}\nfunction Overflow(props, ref) {\n var _props$prefixCls = props.prefixCls,\n prefixCls = _props$prefixCls === void 0 ? 'rc-overflow' : _props$prefixCls,\n _props$data = props.data,\n data = _props$data === void 0 ? [] : _props$data,\n renderItem = props.renderItem,\n renderRawItem = props.renderRawItem,\n itemKey = props.itemKey,\n _props$itemWidth = props.itemWidth,\n itemWidth = _props$itemWidth === void 0 ? 10 : _props$itemWidth,\n ssr = props.ssr,\n style = props.style,\n className = props.className,\n maxCount = props.maxCount,\n renderRest = props.renderRest,\n renderRawRest = props.renderRawRest,\n suffix = props.suffix,\n _props$component = props.component,\n Component = _props$component === void 0 ? 'div' : _props$component,\n itemComponent = props.itemComponent,\n onVisibleChange = props.onVisibleChange,\n restProps = _objectWithoutProperties(props, _excluded);\n var fullySSR = ssr === 'full';\n var notifyEffectUpdate = useBatcher();\n var _useEffectState = useEffectState(notifyEffectUpdate, null),\n _useEffectState2 = _slicedToArray(_useEffectState, 2),\n containerWidth = _useEffectState2[0],\n setContainerWidth = _useEffectState2[1];\n var mergedContainerWidth = containerWidth || 0;\n var _useEffectState3 = useEffectState(notifyEffectUpdate, new Map()),\n _useEffectState4 = _slicedToArray(_useEffectState3, 2),\n itemWidths = _useEffectState4[0],\n setItemWidths = _useEffectState4[1];\n var _useEffectState5 = useEffectState(notifyEffectUpdate, 0),\n _useEffectState6 = _slicedToArray(_useEffectState5, 2),\n prevRestWidth = _useEffectState6[0],\n setPrevRestWidth = _useEffectState6[1];\n var _useEffectState7 = useEffectState(notifyEffectUpdate, 0),\n _useEffectState8 = _slicedToArray(_useEffectState7, 2),\n restWidth = _useEffectState8[0],\n setRestWidth = _useEffectState8[1];\n var _useEffectState9 = useEffectState(notifyEffectUpdate, 0),\n _useEffectState10 = _slicedToArray(_useEffectState9, 2),\n suffixWidth = _useEffectState10[0],\n setSuffixWidth = _useEffectState10[1];\n var _useState = useState(null),\n _useState2 = _slicedToArray(_useState, 2),\n suffixFixedStart = _useState2[0],\n setSuffixFixedStart = _useState2[1];\n var _useState3 = useState(null),\n _useState4 = _slicedToArray(_useState3, 2),\n displayCount = _useState4[0],\n setDisplayCount = _useState4[1];\n var mergedDisplayCount = React.useMemo(function () {\n if (displayCount === null && fullySSR) {\n return Number.MAX_SAFE_INTEGER;\n }\n return displayCount || 0;\n }, [displayCount, containerWidth]);\n var _useState5 = useState(false),\n _useState6 = _slicedToArray(_useState5, 2),\n restReady = _useState6[0],\n setRestReady = _useState6[1];\n var itemPrefixCls = \"\".concat(prefixCls, \"-item
|