1 line
19 KiB
JSON
1 line
19 KiB
JSON
|
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nfunction isPointsEq() {\n var a1 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var a2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n var isAlignPoint = arguments.length > 2 ? arguments[2] : undefined;\n if (isAlignPoint) {\n return a1[0] === a2[0];\n }\n return a1[0] === a2[0] && a1[1] === a2[1];\n}\nexport function getAlignPopupClassName(builtinPlacements, prefixCls, align, isAlignPoint) {\n var points = align.points;\n var placements = Object.keys(builtinPlacements);\n for (var i = 0; i < placements.length; i += 1) {\n var _builtinPlacements$pl;\n var placement = placements[i];\n if (isPointsEq((_builtinPlacements$pl = builtinPlacements[placement]) === null || _builtinPlacements$pl === void 0 ? void 0 : _builtinPlacements$pl.points, points, isAlignPoint)) {\n return \"\".concat(prefixCls, \"-placement-\").concat(placement);\n }\n }\n return '';\n}\n\n/** @deprecated We should not use this if we can refactor all deps */\nexport function getMotion(prefixCls, motion, animation, transitionName) {\n if (motion) {\n return motion;\n }\n if (animation) {\n return {\n motionName: \"\".concat(prefixCls, \"-\").concat(animation)\n };\n }\n if (transitionName) {\n return {\n motionName: transitionName\n };\n }\n return null;\n}\nexport function getWin(ele) {\n return ele.ownerDocument.defaultView;\n}\n\n/**\n * Get all the scrollable parent elements of the element\n * @param ele The element to be detected\n * @param areaOnly Only return the parent which will cut visible area\n */\nexport function collectScroller(ele) {\n var scrollerList = [];\n var current = ele === null || ele === void 0 ? void 0 : ele.parentElement;\n var scrollStyle = ['hidden', 'scroll', 'clip', 'auto'];\n while (current) {\n var _getWin$getComputedSt = getWin(current).getComputedStyle(current),\n overflowX = _getWin$getComputedSt.overflowX,\n overflowY = _getWin$getComputedSt.overflowY,\n overflow = _getWin$getComputedSt.overflow;\n if ([overflowX, overflowY, overflow].some(function (o) {\n return scrollStyle.includes(o);\n })) {\n scrollerList.push(current);\n }\n current = current.parentElement;\n }\n return scrollerList;\n}\nexport function toNum(num) {\n var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n return Number.isNaN(num) ? defaultValue : num;\n}\nfunction getPxValue(val) {\n return toNum(parseFloat(val), 0);\n}\n/**\n *\n *\n * **************************************\n * * Border *\n * * ************************** *\n * * * * * *\n * * B * * S * B *\n * * o * * c * o *\n * * r * Content * r * r *\n * * d * * o * d *\n * * e * * l * e *\n * * r ******************** l * r *\n * * * Scroll * *\n * * ************************** *\n * * Border *\n * **************************************\n *\n */\n/**\n * Get visible area of element\n */\nexport function getVisibleArea(initArea, scrollerList) {\n var visibleArea = _objectSpread({}, initArea);\n (scrollerList || []).forEach(function (ele) {\n if (ele instanceof HTMLBodyElement || ele instanceof HTMLHtmlElement) {\n return;\n }\n\n // Skip if static position which will not affect visible area\n var _getWin$getComputedSt2 = getWin(ele).getComputedStyle(ele),\n overflow = _getWin$getComputedSt2.overflow,\n overflowClipMargin = _getWin$getComputedSt2.overflowClipMargin,\n borderTopWidth = _getWin$getComputedSt2.borderTopWidth,\n borderBottomWidth = _getWin$getComputedSt2.borderBottomWidth,\n borderLeftWidth = _getWin$getComputedSt2.borderLeftWidth,\n borderRightWidth = _getWin$getComputedSt2.borderRightW
|