61efd8f9f67f58388baf4e8d478a6736.json 11.1 KB
{"ast":null,"code":"import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport * as React from 'react';\nimport isMobile from './utils/isMobile';\nexport function noop() {}\nexport function getKeyFromChildrenIndex(child, menuEventKey, index) {\n  var prefix = menuEventKey || '';\n  return child.key || \"\".concat(prefix, \"item_\").concat(index);\n}\nexport function getMenuIdFromSubMenuEventKey(eventKey) {\n  return \"\".concat(eventKey, \"-menu-\");\n}\nexport function loopMenuItem(children, cb) {\n  var index = -1;\n  React.Children.forEach(children, function (c) {\n    index += 1;\n\n    if (c && c.type && c.type.isMenuItemGroup) {\n      React.Children.forEach(c.props.children, function (c2) {\n        index += 1;\n        cb(c2, index);\n      });\n    } else {\n      cb(c, index);\n    }\n  });\n}\nexport function loopMenuItemRecursively(children, keys, ret) {\n  /* istanbul ignore if */\n  if (!children || ret.find) {\n    return;\n  }\n\n  React.Children.forEach(children, function (c) {\n    if (c) {\n      var construct = c.type;\n\n      if (!construct || !(construct.isSubMenu || construct.isMenuItem || construct.isMenuItemGroup)) {\n        return;\n      }\n\n      if (keys.indexOf(c.key) !== -1) {\n        // eslint-disable-next-line no-param-reassign\n        ret.find = true;\n      } else if (c.props.children) {\n        loopMenuItemRecursively(c.props.children, keys, ret);\n      }\n    }\n  });\n}\nexport var menuAllProps = ['defaultSelectedKeys', 'selectedKeys', 'defaultOpenKeys', 'openKeys', 'mode', 'getPopupContainer', 'onSelect', 'onDeselect', 'onDestroy', 'openTransitionName', 'openAnimation', 'subMenuOpenDelay', 'subMenuCloseDelay', 'forceSubMenuRender', 'triggerSubMenuAction', 'level', 'selectable', 'multiple', 'onOpenChange', 'visible', 'focusable', 'defaultActiveFirst', 'prefixCls', 'inlineIndent', 'parentMenu', 'title', 'rootPrefixCls', 'eventKey', 'active', 'onItemHover', 'onTitleMouseEnter', 'onTitleMouseLeave', 'onTitleClick', 'popupAlign', 'popupOffset', 'isOpen', 'renderMenuItem', 'manualRef', 'subMenuKey', 'disabled', 'index', 'isSelected', 'store', 'activeKey', 'builtinPlacements', 'overflowedIndicator', 'motion', // the following keys found need to be removed from test regression\n'attribute', 'value', 'popupClassName', 'inlineCollapsed', 'menu', 'theme', 'itemIcon', 'expandIcon']; // ref: https://github.com/ant-design/ant-design/issues/14007\n// ref: https://bugs.chromium.org/p/chromium/issues/detail?id=360889\n// getBoundingClientRect return the full precision value, which is\n// not the same behavior as on chrome. Set the precision to 6 to\n// unify their behavior\n\nexport var getWidth = function getWidth(elem) {\n  var includeMargin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n  var width = elem && typeof elem.getBoundingClientRect === 'function' && elem.getBoundingClientRect().width;\n\n  if (width) {\n    if (includeMargin) {\n      var _getComputedStyle = getComputedStyle(elem),\n          marginLeft = _getComputedStyle.marginLeft,\n          marginRight = _getComputedStyle.marginRight;\n\n      width += +marginLeft.replace('px', '') + +marginRight.replace('px', '');\n    }\n\n    width = +width.toFixed(6);\n  }\n\n  return width || 0;\n};\nexport var setStyle = function setStyle(elem, styleProperty, value) {\n  if (elem && _typeof(elem.style) === 'object') {\n    // eslint-disable-next-line no-param-reassign\n    elem.style[styleProperty] = value;\n  }\n};\nexport var isMobileDevice = function isMobileDevice() {\n  return isMobile.any;\n};","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-menu/es/util.js"],"names":["_typeof","React","isMobile","noop","getKeyFromChildrenIndex","child","menuEventKey","index","prefix","key","concat","getMenuIdFromSubMenuEventKey","eventKey","loopMenuItem","children","cb","Children","forEach","c","type","isMenuItemGroup","props","c2","loopMenuItemRecursively","keys","ret","find","construct","isSubMenu","isMenuItem","indexOf","menuAllProps","getWidth","elem","includeMargin","arguments","length","undefined","width","getBoundingClientRect","_getComputedStyle","getComputedStyle","marginLeft","marginRight","replace","toFixed","setStyle","styleProperty","value","style","isMobileDevice","any"],"mappings":"AAAA,OAAOA,OAAP,MAAoB,mCAApB;AACA,OAAO,KAAKC,K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C,IAAI,CAACgB,KAAN,CAAP,KAAwB,QAApC,EAA8C;AAC5C;AACAhB,IAAAA,IAAI,CAACgB,KAAL,CAAWF,aAAX,IAA4BC,KAA5B;AACD;AACF,CALM;AAMP,OAAO,IAAIE,cAAc,GAAG,SAASA,cAAT,GAA0B;AACpD,SAAOhD,QAAQ,CAACiD,GAAhB;AACD,CAFM","sourcesContent":["import _typeof from \"@babel/runtime/helpers/esm/typeof\";\nimport * as React from 'react';\nimport isMobile from './utils/isMobile';\nexport function noop() {}\nexport function getKeyFromChildrenIndex(child, menuEventKey, index) {\n  var prefix = menuEventKey || '';\n  return child.key || \"\".concat(prefix, \"item_\").concat(index);\n}\nexport function getMenuIdFromSubMenuEventKey(eventKey) {\n  return \"\".concat(eventKey, \"-menu-\");\n}\nexport function loopMenuItem(children, cb) {\n  var index = -1;\n  React.Children.forEach(children, function (c) {\n    index += 1;\n\n    if (c && c.type && c.type.isMenuItemGroup) {\n      React.Children.forEach(c.props.children, function (c2) {\n        index += 1;\n        cb(c2, index);\n      });\n    } else {\n      cb(c, index);\n    }\n  });\n}\nexport function loopMenuItemRecursively(children, keys, ret) {\n  /* istanbul ignore if */\n  if (!children || ret.find) {\n    return;\n  }\n\n  React.Children.forEach(children, function (c) {\n    if (c) {\n      var construct = c.type;\n\n      if (!construct || !(construct.isSubMenu || construct.isMenuItem || construct.isMenuItemGroup)) {\n        return;\n      }\n\n      if (keys.indexOf(c.key) !== -1) {\n        // eslint-disable-next-line no-param-reassign\n        ret.find = true;\n      } else if (c.props.children) {\n        loopMenuItemRecursively(c.props.children, keys, ret);\n      }\n    }\n  });\n}\nexport var menuAllProps = ['defaultSelectedKeys', 'selectedKeys', 'defaultOpenKeys', 'openKeys', 'mode', 'getPopupContainer', 'onSelect', 'onDeselect', 'onDestroy', 'openTransitionName', 'openAnimation', 'subMenuOpenDelay', 'subMenuCloseDelay', 'forceSubMenuRender', 'triggerSubMenuAction', 'level', 'selectable', 'multiple', 'onOpenChange', 'visible', 'focusable', 'defaultActiveFirst', 'prefixCls', 'inlineIndent', 'parentMenu', 'title', 'rootPrefixCls', 'eventKey', 'active', 'onItemHover', 'onTitleMouseEnter', 'onTitleMouseLeave', 'onTitleClick', 'popupAlign', 'popupOffset', 'isOpen', 'renderMenuItem', 'manualRef', 'subMenuKey', 'disabled', 'index', 'isSelected', 'store', 'activeKey', 'builtinPlacements', 'overflowedIndicator', 'motion', // the following keys found need to be removed from test regression\n'attribute', 'value', 'popupClassName', 'inlineCollapsed', 'menu', 'theme', 'itemIcon', 'expandIcon']; // ref: https://github.com/ant-design/ant-design/issues/14007\n// ref: https://bugs.chromium.org/p/chromium/issues/detail?id=360889\n// getBoundingClientRect return the full precision value, which is\n// not the same behavior as on chrome. Set the precision to 6 to\n// unify their behavior\n\nexport var getWidth = function getWidth(elem) {\n  var includeMargin = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n  var width = elem && typeof elem.getBoundingClientRect === 'function' && elem.getBoundingClientRect().width;\n\n  if (width) {\n    if (includeMargin) {\n      var _getComputedStyle = getComputedStyle(elem),\n          marginLeft = _getComputedStyle.marginLeft,\n          marginRight = _getComputedStyle.marginRight;\n\n      width += +marginLeft.replace('px', '') + +marginRight.replace('px', '');\n    }\n\n    width = +width.toFixed(6);\n  }\n\n  return width || 0;\n};\nexport var setStyle = function setStyle(elem, styleProperty, value) {\n  if (elem && _typeof(elem.style) === 'object') {\n    // eslint-disable-next-line no-param-reassign\n    elem.style[styleProperty] = value;\n  }\n};\nexport var isMobileDevice = function isMobileDevice() {\n  return isMobile.any;\n};"]},"metadata":{},"sourceType":"module"}