PromoCursed/node_modules/.cache/babel-loader/ccd6f6173f49a60d57849732f665301e8e548ae9b5481a6cbbc722a0f93b8f22.json

1 line
13 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectDestructuringEmpty from \"@babel/runtime/helpers/esm/objectDestructuringEmpty\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"className\", \"style\", \"motion\", \"motionNodes\", \"motionType\", \"onMotionStart\", \"onMotionEnd\", \"active\", \"treeNodeRequiredProps\"];\nimport classNames from 'classnames';\nimport CSSMotion from 'rc-motion';\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nimport * as React from 'react';\nimport { TreeContext } from \"./contextTypes\";\nimport TreeNode from \"./TreeNode\";\nimport useUnmount from \"./useUnmount\";\nimport { getTreeNodeProps } from \"./utils/treeUtil\";\nvar MotionTreeNode = function MotionTreeNode(_ref, ref) {\n var className = _ref.className,\n style = _ref.style,\n motion = _ref.motion,\n motionNodes = _ref.motionNodes,\n motionType = _ref.motionType,\n onOriginMotionStart = _ref.onMotionStart,\n onOriginMotionEnd = _ref.onMotionEnd,\n active = _ref.active,\n treeNodeRequiredProps = _ref.treeNodeRequiredProps,\n props = _objectWithoutProperties(_ref, _excluded);\n var _React$useState = React.useState(true),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n visible = _React$useState2[0],\n setVisible = _React$useState2[1];\n var _React$useContext = React.useContext(TreeContext),\n prefixCls = _React$useContext.prefixCls;\n\n // Calculate target visible here.\n // And apply in effect to make `leave` motion work.\n var targetVisible = motionNodes && motionType !== 'hide';\n useLayoutEffect(function () {\n if (motionNodes) {\n if (targetVisible !== visible) {\n setVisible(targetVisible);\n }\n }\n }, [motionNodes]);\n var triggerMotionStart = function triggerMotionStart() {\n if (motionNodes) {\n onOriginMotionStart();\n }\n };\n\n // Should only trigger once\n var triggerMotionEndRef = React.useRef(false);\n var triggerMotionEnd = function triggerMotionEnd() {\n if (motionNodes && !triggerMotionEndRef.current) {\n triggerMotionEndRef.current = true;\n onOriginMotionEnd();\n }\n };\n\n // Effect if unmount\n useUnmount(triggerMotionStart, triggerMotionEnd);\n\n // Motion end event\n var onVisibleChanged = function onVisibleChanged(nextVisible) {\n if (targetVisible === nextVisible) {\n triggerMotionEnd();\n }\n };\n if (motionNodes) {\n return /*#__PURE__*/React.createElement(CSSMotion, _extends({\n ref: ref,\n visible: visible\n }, motion, {\n motionAppear: motionType === 'show',\n onVisibleChanged: onVisibleChanged\n }), function (_ref2, motionRef) {\n var motionClassName = _ref2.className,\n motionStyle = _ref2.style;\n return /*#__PURE__*/React.createElement(\"div\", {\n ref: motionRef,\n className: classNames(\"\".concat(prefixCls, \"-treenode-motion\"), motionClassName),\n style: motionStyle\n }, motionNodes.map(function (treeNode) {\n var restProps = Object.assign({}, (_objectDestructuringEmpty(treeNode.data), treeNode.data)),\n title = treeNode.title,\n key = treeNode.key,\n isStart = treeNode.isStart,\n isEnd = treeNode.isEnd;\n delete restProps.children;\n var treeNodeProps = getTreeNodeProps(key, treeNodeRequiredProps);\n return /*#__PURE__*/React.createElement(TreeNode, _extends({}, restProps, treeNodeProps, {\n title: title,\n active: active,\n data: treeNode.data,\n key: key,\n isStart: isStart,\n isEnd: isEnd\n }));\n }));\n });\n }\n return /*#__PURE__*/React.createElement(TreeNode, _extends({\n domRef: ref,\n className: className,\n style: style\n }, props, {\n active: active\n }));\n};\nMotionTreeNode.displayName = 'MotionTreeNode';\nvar RefMotionTreeNode =