1f7217b3d8366503f9255d20fbcabd23.json
14.8 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport * as React from 'react';\nimport RcDropdown from 'rc-dropdown';\nimport classNames from 'classnames';\nimport RightOutlined from '@ant-design/icons/RightOutlined';\nimport DropdownButton from './dropdown-button';\nimport { ConfigContext } from '../config-provider';\nimport devWarning from '../_util/devWarning';\nimport { tuple } from '../_util/type';\nimport { cloneElement } from '../_util/reactNode';\nvar Placements = tuple('topLeft', 'topCenter', 'topRight', 'bottomLeft', 'bottomCenter', 'bottomRight');\n\nvar Dropdown = function Dropdown(props) {\n var _React$useContext = React.useContext(ConfigContext),\n getContextPopupContainer = _React$useContext.getPopupContainer,\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction;\n\n var getTransitionName = function getTransitionName() {\n var _props$placement = props.placement,\n placement = _props$placement === void 0 ? '' : _props$placement,\n transitionName = props.transitionName;\n\n if (transitionName !== undefined) {\n return transitionName;\n }\n\n if (placement.indexOf('top') >= 0) {\n return 'slide-down';\n }\n\n return 'slide-up';\n };\n\n var renderOverlay = function renderOverlay(prefixCls) {\n // rc-dropdown already can process the function of overlay, but we have check logic here.\n // So we need render the element to check and pass back to rc-dropdown.\n var overlay = props.overlay;\n var overlayNode;\n\n if (typeof overlay === 'function') {\n overlayNode = overlay();\n } else {\n overlayNode = overlay;\n }\n\n overlayNode = React.Children.only(typeof overlayNode === 'string' ? /*#__PURE__*/React.createElement(\"span\", null, overlayNode) : overlayNode);\n var overlayProps = overlayNode.props; // Warning if use other mode\n\n devWarning(!overlayProps.mode || overlayProps.mode === 'vertical', 'Dropdown', \"mode=\\\"\".concat(overlayProps.mode, \"\\\" is not supported for Dropdown's Menu.\")); // menu cannot be selectable in dropdown defaultly\n // menu should be focusable in dropdown defaultly\n\n var _overlayProps$selecta = overlayProps.selectable,\n selectable = _overlayProps$selecta === void 0 ? false : _overlayProps$selecta,\n _overlayProps$focusab = overlayProps.focusable,\n focusable = _overlayProps$focusab === void 0 ? true : _overlayProps$focusab;\n var expandIcon = /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-menu-submenu-arrow\")\n }, /*#__PURE__*/React.createElement(RightOutlined, {\n className: \"\".concat(prefixCls, \"-menu-submenu-arrow-icon\")\n }));\n var fixedModeOverlay = typeof overlayNode.type === 'string' ? overlayNode : cloneElement(overlayNode, {\n mode: 'vertical',\n selectable: selectable,\n focusable: focusable,\n expandIcon: expandIcon\n });\n return fixedModeOverlay;\n };\n\n var getPlacement = function getPlacement() {\n var placement = props.placement;\n\n if (placement !== undefined) {\n return placement;\n }\n\n return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';\n };\n\n var arrow = props.arrow,\n customizePrefixCls = props.prefixCls,\n children = props.children,\n trigger = props.trigger,\n disabled = props.disabled,\n getPopupContainer = props.getPopupContainer,\n overlayClassName = props.overlayClassName;\n var prefixCls = getPrefixCls('dropdown', customizePrefixCls);\n var child = React.Children.only(children);\n var dropdownTrigger = cloneElement(child, {\n className: classNames(\"\".concat(prefixCls, \"-trigger\"), _defineProperty({}, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), child.props.className),\n disabled: disabled\n });\n var overlayClassNameCustomized = classNames(overlayClassName, _defineProperty({}, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'));\n var triggerActions = disabled ? [] : trigger;\n var alignPoint;\n\n if (triggerActions && triggerActions.indexOf('contextMenu') !== -1) {\n alignPoint = true;\n }\n\n return /*#__PURE__*/React.createElement(RcDropdown, _extends({\n arrow: arrow,\n alignPoint: alignPoint\n }, props, {\n overlayClassName: overlayClassNameCustomized,\n prefixCls: prefixCls,\n getPopupContainer: getPopupContainer || getContextPopupContainer,\n transitionName: getTransitionName(),\n trigger: triggerActions,\n overlay: function overlay() {\n return renderOverlay(prefixCls);\n },\n placement: getPlacement()\n }), dropdownTrigger);\n};\n\nDropdown.Button = DropdownButton;\nDropdown.defaultProps = {\n mouseEnterDelay: 0.15,\n mouseLeaveDelay: 0.1\n};\nexport default Dropdown;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/dropdown/dropdown.js"],"names":["_extends","_defineProperty","React","RcDropdown","classNames","RightOutlined","DropdownButton","ConfigContext","devWarning","tuple","cloneElement","Placements","Dropdown","props","_React$useContext","useContext","getContextPopupContainer","getPopupContainer","getPrefixCls","direction","getTransitionName","_props$placement","placement","transitionName","undefined","indexOf","renderOverlay","prefixCls","overlay","overlayNode","Children","only","createElement","overlayProps","mode","concat","_overlayProps$selecta","selectable","_overlayProps$focusab","focusable","expandIcon","className","fixedModeOverlay","type","getPlacement","arrow","customizePrefixCls","children","trigger","disabled","overlayClassName","child","dropdownTrigger","overlayClassNameCustomized","triggerActions","alignPoint","Button","defaultProps","mouseEnterDelay","mouseLeaveDelay"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,UAAP,MAAuB,aAAvB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,aAAP,MAA0B,iCAA1B;AACA,OAAOC,cAAP,MAA2B,mBAA3B;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,OAAOC,UAAP,MAAuB,qBAAvB;AACA,SAASC,KAAT,QAAsB,eAAtB;AACA,SAASC,YAAT,QAA6B,oBAA7B;AACA,IAAIC,UAAU,GAAGF,KAAK,CAAC,SAAD,EAAY,WAAZ,EAAyB,UAAzB,EAAqC,YAArC,EAAmD,cAAnD,EAAmE,aAAnE,CAAtB;;AAEA,IAAIG,QAAQ,GAAG,SAASA,QAAT,CAAkBC,KAAlB,EAAyB;AACtC,MAAIC,iBAAiB,GAAGZ,KAAK,CAACa,UAAN,CAAiBR,aAAjB,CAAxB;AAAA,MACIS,wBAAwB,GAAGF,iBAAiB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3D6C,IAAAA,KAAK,EAAEA,KADoD;AAE3DU,IAAAA,UAAU,EAAEA;AAF+C,GAAD,EAGzD1C,KAHyD,EAGlD;AACRqC,IAAAA,gBAAgB,EAAEG,0BADV;AAER1B,IAAAA,SAAS,EAAEA,SAFH;AAGRV,IAAAA,iBAAiB,EAAEA,iBAAiB,IAAID,wBAHhC;AAIRO,IAAAA,cAAc,EAAEH,iBAAiB,EAJzB;AAKR4B,IAAAA,OAAO,EAAEM,cALD;AAMR1B,IAAAA,OAAO,EAAE,SAASA,OAAT,GAAmB;AAC1B,aAAOF,aAAa,CAACC,SAAD,CAApB;AACD,KARO;AASRL,IAAAA,SAAS,EAAEsB,YAAY;AATf,GAHkD,CAAxC,EAahBQ,eAbgB,CAApB;AAcD,CAvGD;;AAyGAxC,QAAQ,CAAC4C,MAAT,GAAkBlD,cAAlB;AACAM,QAAQ,CAAC6C,YAAT,GAAwB;AACtBC,EAAAA,eAAe,EAAE,IADK;AAEtBC,EAAAA,eAAe,EAAE;AAFK,CAAxB;AAIA,eAAe/C,QAAf","sourcesContent":["import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport * as React from 'react';\nimport RcDropdown from 'rc-dropdown';\nimport classNames from 'classnames';\nimport RightOutlined from '@ant-design/icons/RightOutlined';\nimport DropdownButton from './dropdown-button';\nimport { ConfigContext } from '../config-provider';\nimport devWarning from '../_util/devWarning';\nimport { tuple } from '../_util/type';\nimport { cloneElement } from '../_util/reactNode';\nvar Placements = tuple('topLeft', 'topCenter', 'topRight', 'bottomLeft', 'bottomCenter', 'bottomRight');\n\nvar Dropdown = function Dropdown(props) {\n var _React$useContext = React.useContext(ConfigContext),\n getContextPopupContainer = _React$useContext.getPopupContainer,\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction;\n\n var getTransitionName = function getTransitionName() {\n var _props$placement = props.placement,\n placement = _props$placement === void 0 ? '' : _props$placement,\n transitionName = props.transitionName;\n\n if (transitionName !== undefined) {\n return transitionName;\n }\n\n if (placement.indexOf('top') >= 0) {\n return 'slide-down';\n }\n\n return 'slide-up';\n };\n\n var renderOverlay = function renderOverlay(prefixCls) {\n // rc-dropdown already can process the function of overlay, but we have check logic here.\n // So we need render the element to check and pass back to rc-dropdown.\n var overlay = props.overlay;\n var overlayNode;\n\n if (typeof overlay === 'function') {\n overlayNode = overlay();\n } else {\n overlayNode = overlay;\n }\n\n overlayNode = React.Children.only(typeof overlayNode === 'string' ? /*#__PURE__*/React.createElement(\"span\", null, overlayNode) : overlayNode);\n var overlayProps = overlayNode.props; // Warning if use other mode\n\n devWarning(!overlayProps.mode || overlayProps.mode === 'vertical', 'Dropdown', \"mode=\\\"\".concat(overlayProps.mode, \"\\\" is not supported for Dropdown's Menu.\")); // menu cannot be selectable in dropdown defaultly\n // menu should be focusable in dropdown defaultly\n\n var _overlayProps$selecta = overlayProps.selectable,\n selectable = _overlayProps$selecta === void 0 ? false : _overlayProps$selecta,\n _overlayProps$focusab = overlayProps.focusable,\n focusable = _overlayProps$focusab === void 0 ? true : _overlayProps$focusab;\n var expandIcon = /*#__PURE__*/React.createElement(\"span\", {\n className: \"\".concat(prefixCls, \"-menu-submenu-arrow\")\n }, /*#__PURE__*/React.createElement(RightOutlined, {\n className: \"\".concat(prefixCls, \"-menu-submenu-arrow-icon\")\n }));\n var fixedModeOverlay = typeof overlayNode.type === 'string' ? overlayNode : cloneElement(overlayNode, {\n mode: 'vertical',\n selectable: selectable,\n focusable: focusable,\n expandIcon: expandIcon\n });\n return fixedModeOverlay;\n };\n\n var getPlacement = function getPlacement() {\n var placement = props.placement;\n\n if (placement !== undefined) {\n return placement;\n }\n\n return direction === 'rtl' ? 'bottomRight' : 'bottomLeft';\n };\n\n var arrow = props.arrow,\n customizePrefixCls = props.prefixCls,\n children = props.children,\n trigger = props.trigger,\n disabled = props.disabled,\n getPopupContainer = props.getPopupContainer,\n overlayClassName = props.overlayClassName;\n var prefixCls = getPrefixCls('dropdown', customizePrefixCls);\n var child = React.Children.only(children);\n var dropdownTrigger = cloneElement(child, {\n className: classNames(\"\".concat(prefixCls, \"-trigger\"), _defineProperty({}, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), child.props.className),\n disabled: disabled\n });\n var overlayClassNameCustomized = classNames(overlayClassName, _defineProperty({}, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'));\n var triggerActions = disabled ? [] : trigger;\n var alignPoint;\n\n if (triggerActions && triggerActions.indexOf('contextMenu') !== -1) {\n alignPoint = true;\n }\n\n return /*#__PURE__*/React.createElement(RcDropdown, _extends({\n arrow: arrow,\n alignPoint: alignPoint\n }, props, {\n overlayClassName: overlayClassNameCustomized,\n prefixCls: prefixCls,\n getPopupContainer: getPopupContainer || getContextPopupContainer,\n transitionName: getTransitionName(),\n trigger: triggerActions,\n overlay: function overlay() {\n return renderOverlay(prefixCls);\n },\n placement: getPlacement()\n }), dropdownTrigger);\n};\n\nDropdown.Button = DropdownButton;\nDropdown.defaultProps = {\n mouseEnterDelay: 0.15,\n mouseLeaveDelay: 0.1\n};\nexport default Dropdown;"]},"metadata":{},"sourceType":"module"}