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

1 line
9.2 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 _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport CSSMotion from 'rc-motion';\nimport { getMotion } from \"../utils/motionUtil\";\nimport MenuContextProvider, { MenuContext } from \"../context/MenuContext\";\nimport SubMenuList from \"./SubMenuList\";\nexport default function InlineSubMenuList(_ref) {\n var id = _ref.id,\n open = _ref.open,\n keyPath = _ref.keyPath,\n children = _ref.children;\n var fixedMode = 'inline';\n var _React$useContext = React.useContext(MenuContext),\n prefixCls = _React$useContext.prefixCls,\n forceSubMenuRender = _React$useContext.forceSubMenuRender,\n motion = _React$useContext.motion,\n defaultMotions = _React$useContext.defaultMotions,\n mode = _React$useContext.mode;\n\n // Always use latest mode check\n var sameModeRef = React.useRef(false);\n sameModeRef.current = mode === fixedMode;\n\n // We record `destroy` mark here since when mode change from `inline` to others.\n // The inline list should remove when motion end.\n var _React$useState = React.useState(!sameModeRef.current),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n destroy = _React$useState2[0],\n setDestroy = _React$useState2[1];\n var mergedOpen = sameModeRef.current ? open : false;\n\n // ================================= Effect =================================\n // Reset destroy state when mode change back\n React.useEffect(function () {\n if (sameModeRef.current) {\n setDestroy(false);\n }\n }, [mode]);\n\n // ================================= Render =================================\n var mergedMotion = _objectSpread({}, getMotion(fixedMode, motion, defaultMotions));\n\n // No need appear since nest inlineCollapse changed\n if (keyPath.length > 1) {\n mergedMotion.motionAppear = false;\n }\n\n // Hide inline list when mode changed and motion end\n var originOnVisibleChanged = mergedMotion.onVisibleChanged;\n mergedMotion.onVisibleChanged = function (newVisible) {\n if (!sameModeRef.current && !newVisible) {\n setDestroy(true);\n }\n return originOnVisibleChanged === null || originOnVisibleChanged === void 0 ? void 0 : originOnVisibleChanged(newVisible);\n };\n if (destroy) {\n return null;\n }\n return /*#__PURE__*/React.createElement(MenuContextProvider, {\n mode: fixedMode,\n locked: !sameModeRef.current\n }, /*#__PURE__*/React.createElement(CSSMotion, _extends({\n visible: mergedOpen\n }, mergedMotion, {\n forceRender: forceSubMenuRender,\n removeOnLeave: false,\n leavedClassName: \"\".concat(prefixCls, \"-hidden\")\n }), function (_ref2) {\n var motionClassName = _ref2.className,\n motionStyle = _ref2.style;\n return /*#__PURE__*/React.createElement(SubMenuList, {\n id: id,\n className: motionClassName,\n style: motionStyle\n }, children);\n }));\n}","map":{"version":3,"names":["_extends","_objectSpread","_slicedToArray","React","CSSMotion","getMotion","MenuContextProvider","MenuContext","SubMenuList","InlineSubMenuList","_ref","id","open","keyPath","children","fixedMode","_React$useContext","useContext","prefixCls","forceSubMenuRender","motion","defaultMotions","mode","sameModeRef","useRef","current","_React$useState","useState","_React$useState2","destroy","setDestroy","mergedOpen","useEffect","mergedMotion","length","motionAppear","originOnVisibleChanged","onVisibleChanged","newVisible","createElement","locked","visible","forceRender","removeOnLeave","leavedClassName","concat","_ref2","motionClassName","className","motionStyle","style"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-menu/es/SubMenu/InlineSubMenuList.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/