1 line
16 KiB
JSON
1 line
16 KiB
JSON
|
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"prefixCls\", \"disabled\", \"visible\", \"children\", \"popupElement\", \"animation\", \"transitionName\", \"dropdownStyle\", \"dropdownClassName\", \"direction\", \"placement\", \"builtinPlacements\", \"dropdownMatchSelectWidth\", \"dropdownRender\", \"dropdownAlign\", \"getPopupContainer\", \"empty\", \"getTriggerDOMNode\", \"onPopupVisibleChange\", \"onPopupMouseEnter\"];\nimport Trigger from '@rc-component/trigger';\nimport classNames from 'classnames';\nimport * as React from 'react';\nvar getBuiltInPlacements = function getBuiltInPlacements(dropdownMatchSelectWidth) {\n // Enable horizontal overflow auto-adjustment when a custom dropdown width is provided\n var adjustX = dropdownMatchSelectWidth === true ? 0 : 1;\n return {\n bottomLeft: {\n points: ['tl', 'bl'],\n offset: [0, 4],\n overflow: {\n adjustX: adjustX,\n adjustY: 1\n },\n htmlRegion: 'scroll'\n },\n bottomRight: {\n points: ['tr', 'br'],\n offset: [0, 4],\n overflow: {\n adjustX: adjustX,\n adjustY: 1\n },\n htmlRegion: 'scroll'\n },\n topLeft: {\n points: ['bl', 'tl'],\n offset: [0, -4],\n overflow: {\n adjustX: adjustX,\n adjustY: 1\n },\n htmlRegion: 'scroll'\n },\n topRight: {\n points: ['br', 'tr'],\n offset: [0, -4],\n overflow: {\n adjustX: adjustX,\n adjustY: 1\n },\n htmlRegion: 'scroll'\n }\n };\n};\nvar SelectTrigger = function SelectTrigger(props, ref) {\n var prefixCls = props.prefixCls,\n disabled = props.disabled,\n visible = props.visible,\n children = props.children,\n popupElement = props.popupElement,\n animation = props.animation,\n transitionName = props.transitionName,\n dropdownStyle = props.dropdownStyle,\n dropdownClassName = props.dropdownClassName,\n _props$direction = props.direction,\n direction = _props$direction === void 0 ? 'ltr' : _props$direction,\n placement = props.placement,\n builtinPlacements = props.builtinPlacements,\n dropdownMatchSelectWidth = props.dropdownMatchSelectWidth,\n dropdownRender = props.dropdownRender,\n dropdownAlign = props.dropdownAlign,\n getPopupContainer = props.getPopupContainer,\n empty = props.empty,\n getTriggerDOMNode = props.getTriggerDOMNode,\n onPopupVisibleChange = props.onPopupVisibleChange,\n onPopupMouseEnter = props.onPopupMouseEnter,\n restProps = _objectWithoutProperties(props, _excluded);\n var dropdownPrefixCls = \"\".concat(prefixCls, \"-dropdown\");\n var popupNode = popupElement;\n if (dropdownRender) {\n popupNode = dropdownRender(popupElement);\n }\n var mergedBuiltinPlacements = React.useMemo(function () {\n return builtinPlacements || getBuiltInPlacements(dropdownMatchSelectWidth);\n }, [builtinPlacements, dropdownMatchSelectWidth]);\n\n // ===================== Motion ======================\n var mergedTransitionName = animation ? \"\".concat(dropdownPrefixCls, \"-\").concat(animation) : transitionName;\n\n // =================== Popup Width ===================\n var isNumberPopupWidth = typeof dropdownMatchSelectWidth === 'number';\n var stretch = React.useMemo(function () {\n if (isNumberPopupWidth) {\n return null;\n }\n return dropdownMatchSelectWidth === false ? 'minWidth' : 'width';\n }, [dropdownMatchSelectWidth, isNumberPopupWidth]);\n var popupStyle = dropdownStyle;\n if (isNumberPopupWidth) {\n popupStyle = _objectSpread(_objectSpread({}, popupStyle), {}, {\n width: dropdownMatchSelectWidth\n });\n }\n\n // ======================= Ref =======================\n var triggerPopupRef = React.useRef(null);\n React.useImperativeHandle
|