55a43b3532d5f3740ec5aa20c34b4de1.json
11.2 KB
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport { useEffect } from 'react';\nimport classNames from 'classnames';\nimport CSSMotion from 'rc-motion';\nimport TreeNode from './TreeNode';\nimport { getTreeNodeProps } from './utils/treeUtil';\nimport { TreeContext } from './contextTypes';\n\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, [\"className\", \"style\", \"motion\", \"motionNodes\", \"motionType\", \"onMotionStart\", \"onMotionEnd\", \"active\", \"treeNodeRequiredProps\"]);\n\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\n var _React$useContext = React.useContext(TreeContext),\n prefixCls = _React$useContext.prefixCls;\n\n var motionedRef = React.useRef(false);\n\n var onMotionEnd = function onMotionEnd() {\n if (!motionedRef.current) {\n onOriginMotionEnd();\n }\n\n motionedRef.current = true;\n };\n\n useEffect(function () {\n if (motionNodes && motionType === 'hide' && visible) {\n setVisible(false);\n }\n }, [motionNodes]);\n useEffect(function () {\n // Trigger motion only when patched\n if (motionNodes) {\n onOriginMotionStart();\n }\n\n return function () {\n if (motionNodes) {\n onMotionEnd();\n }\n };\n }, []);\n\n if (motionNodes) {\n return /*#__PURE__*/React.createElement(CSSMotion, Object.assign({\n ref: ref,\n visible: visible\n }, motion, {\n motionAppear: motionType === 'show',\n onAppearEnd: onMotionEnd,\n onLeaveEnd: onMotionEnd\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 _treeNode$data = treeNode.data,\n key = _treeNode$data.key,\n restProps = _objectWithoutProperties(_treeNode$data, [\"key\"]),\n isStart = treeNode.isStart,\n isEnd = treeNode.isEnd;\n\n delete restProps.children;\n var treeNodeProps = getTreeNodeProps(key, treeNodeRequiredProps);\n return /*#__PURE__*/React.createElement(TreeNode, Object.assign({}, restProps, treeNodeProps, {\n active: active,\n data: treeNode.data,\n key: key,\n isStart: isStart,\n isEnd: isEnd\n }));\n }));\n });\n }\n\n return /*#__PURE__*/React.createElement(TreeNode, Object.assign({\n domRef: ref,\n className: className,\n style: style\n }, props, {\n active: active\n }));\n};\n\nMotionTreeNode.displayName = 'MotionTreeNode';\nvar RefMotionTreeNode = /*#__PURE__*/React.forwardRef(MotionTreeNode);\nexport default RefMotionTreeNode;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-tree/es/MotionTreeNode.js"],"names":["_slicedToArray","_objectWithoutProperties","React","useEffect","classNames","CSSMotion","TreeNode","getTreeNodeProps","TreeContext","MotionTreeNode","_ref","ref","className","style","motion","motionNodes","motionType","onOriginMotionStart","onMotionStart","onOriginMotionEnd","onMotionEnd","active","treeNodeRequiredProps","props","_React$useState","useState","_React$useState2","visible","setVisible","_React$useContext","useContext","prefixCls","motionedRef","useRef","current","createElement","Object","assign","motionAppear","onAppearEnd","onLeaveEnd","_ref2","motionRef","motionClassName","motionStyle","concat","map","treeNode","_treeNode$data","data","key","restProps","isStart","isEnd","children","treeNodeProps","domRef","displayName","RefMotionTreeNode","forwardRef"],"mappings":"AAAA,OAAOA,cAAP,MAA2B,0CAA3B;AACA,OAAOC,wBAAP,MAAqC,oDAArC;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAA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;AACRF,IAAAA,MAAM,EAAEA;AADA,GAJwC,CAA9B,CAApB;AAOD,CA1FD;;AA4FAZ,cAAc,CAACgD,WAAf,GAA6B,gBAA7B;AACA,IAAIC,iBAAiB,GAAG,aAAaxD,KAAK,CAACyD,UAAN,CAAiBlD,cAAjB,CAArC;AACA,eAAeiD,iBAAf","sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport * as React from 'react';\nimport { useEffect } from 'react';\nimport classNames from 'classnames';\nimport CSSMotion from 'rc-motion';\nimport TreeNode from './TreeNode';\nimport { getTreeNodeProps } from './utils/treeUtil';\nimport { TreeContext } from './contextTypes';\n\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, [\"className\", \"style\", \"motion\", \"motionNodes\", \"motionType\", \"onMotionStart\", \"onMotionEnd\", \"active\", \"treeNodeRequiredProps\"]);\n\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\n var _React$useContext = React.useContext(TreeContext),\n prefixCls = _React$useContext.prefixCls;\n\n var motionedRef = React.useRef(false);\n\n var onMotionEnd = function onMotionEnd() {\n if (!motionedRef.current) {\n onOriginMotionEnd();\n }\n\n motionedRef.current = true;\n };\n\n useEffect(function () {\n if (motionNodes && motionType === 'hide' && visible) {\n setVisible(false);\n }\n }, [motionNodes]);\n useEffect(function () {\n // Trigger motion only when patched\n if (motionNodes) {\n onOriginMotionStart();\n }\n\n return function () {\n if (motionNodes) {\n onMotionEnd();\n }\n };\n }, []);\n\n if (motionNodes) {\n return /*#__PURE__*/React.createElement(CSSMotion, Object.assign({\n ref: ref,\n visible: visible\n }, motion, {\n motionAppear: motionType === 'show',\n onAppearEnd: onMotionEnd,\n onLeaveEnd: onMotionEnd\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 _treeNode$data = treeNode.data,\n key = _treeNode$data.key,\n restProps = _objectWithoutProperties(_treeNode$data, [\"key\"]),\n isStart = treeNode.isStart,\n isEnd = treeNode.isEnd;\n\n delete restProps.children;\n var treeNodeProps = getTreeNodeProps(key, treeNodeRequiredProps);\n return /*#__PURE__*/React.createElement(TreeNode, Object.assign({}, restProps, treeNodeProps, {\n active: active,\n data: treeNode.data,\n key: key,\n isStart: isStart,\n isEnd: isEnd\n }));\n }));\n });\n }\n\n return /*#__PURE__*/React.createElement(TreeNode, Object.assign({\n domRef: ref,\n className: className,\n style: style\n }, props, {\n active: active\n }));\n};\n\nMotionTreeNode.displayName = 'MotionTreeNode';\nvar RefMotionTreeNode = /*#__PURE__*/React.forwardRef(MotionTreeNode);\nexport default RefMotionTreeNode;"]},"metadata":{},"sourceType":"module"}