b29865a8daf5e31916de07f37f0cb954.json
8.52 KB
{"ast":null,"code":"import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport Menu, { MenuItem } from 'rc-menu';\nimport * as React from 'react';\nimport { MentionsContextConsumer } from './MentionsContext';\n/**\n * We only use Menu to display the candidate.\n * The focus is controlled by textarea to make accessibility easy.\n */\n\nvar DropdownMenu = /*#__PURE__*/function (_React$Component) {\n _inherits(DropdownMenu, _React$Component);\n\n var _super = _createSuper(DropdownMenu);\n\n function DropdownMenu() {\n var _this;\n\n _classCallCheck(this, DropdownMenu);\n\n _this = _super.apply(this, arguments);\n\n _this.renderDropdown = function (_ref) {\n var notFoundContent = _ref.notFoundContent,\n activeIndex = _ref.activeIndex,\n setActiveIndex = _ref.setActiveIndex,\n selectOption = _ref.selectOption,\n onFocus = _ref.onFocus,\n onBlur = _ref.onBlur;\n var _this$props = _this.props,\n prefixCls = _this$props.prefixCls,\n options = _this$props.options;\n var activeOption = options[activeIndex] || {};\n return React.createElement(Menu, {\n prefixCls: \"\".concat(prefixCls, \"-menu\"),\n activeKey: activeOption.key,\n onSelect: function onSelect(_ref2) {\n var key = _ref2.key;\n var option = options.find(function (_ref3) {\n var optionKey = _ref3.key;\n return optionKey === key;\n });\n selectOption(option);\n },\n onFocus: onFocus,\n onBlur: onBlur\n }, options.map(function (option, index) {\n var key = option.key,\n disabled = option.disabled,\n children = option.children,\n className = option.className,\n style = option.style;\n return React.createElement(MenuItem, {\n key: key,\n disabled: disabled,\n className: className,\n style: style,\n onMouseEnter: function onMouseEnter() {\n setActiveIndex(index);\n }\n }, children);\n }), !options.length && React.createElement(MenuItem, {\n disabled: true\n }, notFoundContent));\n };\n\n return _this;\n }\n\n _createClass(DropdownMenu, [{\n key: \"render\",\n value: function render() {\n return React.createElement(MentionsContextConsumer, null, this.renderDropdown);\n }\n }]);\n\n return DropdownMenu;\n}(React.Component);\n\nexport default DropdownMenu;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-mentions/es/DropdownMenu.js"],"names":["_classCallCheck","_createClass","_inherits","_createSuper","Menu","MenuItem","React","MentionsContextConsumer","DropdownMenu","_React$Component","_super","_this","apply","arguments","renderDropdown","_ref","notFoundContent","activeIndex","setActiveIndex","selectOption","onFocus","onBlur","_this$props","props","prefixCls","options","activeOption","createElement","concat","activeKey","key","onSelect","_ref2","option","find","_ref3","optionKey","map","index","disabled","children","className","style","onMouseEnter","length","value","render","Component"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,2CAA5B;AACA,OAAOC,YAAP,MAAyB,wCAAzB;AACA,OAAOC,SAAP,MAAsB,qCAAtB;AACA,OAAOC,YAAP,MAAyB,wCAAzB;AACA,OAAOC,IAAP,IAAeC,QAAf,QAA+B,SAA/B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,uBAAT,QAAwC,mBAAxC;AACA;AACA;AACA;AACA;;AAEA,IAAIC,YAAY,GAAG,aAAa,UAAUC,gBAAV,EAA4B;AAC1DP,EAAAA,SAAS,CAACM,YAAD,EAAeC,gBAAf,CAAT;;AAEA,MAAIC,MAAM,GAAGP,YAAY,CAACK,YAAD,CAAzB;;AAEA,WAASA,YAAT,GAAwB;AACtB,QAAIG,KAAJ;;AAEAX,IAAAA,eAAe,CAAC,IAAD,EAAOQ,YAAP,CAAf;;AAEAG,IAAAA,KAAK,GAAGD,MAAM,CAACE,KAAP,CAAa,IAAb,EAAmBC,SAAnB,CAAR;;AAEAF,IAAAA,KAAK,CAACG,cAAN,GAAuB,UAAUC,IAAV,EAAgB;AACrC,UAAIC,eAAe,GAAGD,IAAI,CAACC,eAA3B;AAAA,UACIC,WAAW,GAAGF,IAAI,CAACE,WADvB;AAAA,UAEIC,cAAc,GAAGH,IAAI,CAACG,cAF1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AOpC,KAAK,CAACqB,aAAN,CAAoBtB,QAApB,EAA8B;AACnCyB,UAAAA,GAAG,EAAEA,GAD8B;AAEnCS,UAAAA,QAAQ,EAAEA,QAFyB;AAGnCE,UAAAA,SAAS,EAAEA,SAHwB;AAInCC,UAAAA,KAAK,EAAEA,KAJ4B;AAKnCC,UAAAA,YAAY,EAAE,SAASA,YAAT,GAAwB;AACpCzB,YAAAA,cAAc,CAACoB,KAAD,CAAd;AACD;AAPkC,SAA9B,EAQJE,QARI,CAAP;AASD,OAfE,CAbI,EA4BH,CAACf,OAAO,CAACmB,MAAT,IAAmBtC,KAAK,CAACqB,aAAN,CAAoBtB,QAApB,EAA8B;AACnDkC,QAAAA,QAAQ,EAAE;AADyC,OAA9B,EAEpBvB,eAFoB,CA5BhB,CAAP;AA+BD,KA1CD;;AA4CA,WAAOL,KAAP;AACD;;AAEDV,EAAAA,YAAY,CAACO,YAAD,EAAe,CAAC;AAC1BsB,IAAAA,GAAG,EAAE,QADqB;AAE1Be,IAAAA,KAAK,EAAE,SAASC,MAAT,GAAkB;AACvB,aAAOxC,KAAK,CAACqB,aAAN,CAAoBpB,uBAApB,EAA6C,IAA7C,EAAmD,KAAKO,cAAxD,CAAP;AACD;AAJyB,GAAD,CAAf,CAAZ;;AAOA,SAAON,YAAP;AACD,CAnE+B,CAmE9BF,KAAK,CAACyC,SAnEwB,CAAhC;;AAqEA,eAAevC,YAAf","sourcesContent":["import _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport Menu, { MenuItem } from 'rc-menu';\nimport * as React from 'react';\nimport { MentionsContextConsumer } from './MentionsContext';\n/**\n * We only use Menu to display the candidate.\n * The focus is controlled by textarea to make accessibility easy.\n */\n\nvar DropdownMenu = /*#__PURE__*/function (_React$Component) {\n _inherits(DropdownMenu, _React$Component);\n\n var _super = _createSuper(DropdownMenu);\n\n function DropdownMenu() {\n var _this;\n\n _classCallCheck(this, DropdownMenu);\n\n _this = _super.apply(this, arguments);\n\n _this.renderDropdown = function (_ref) {\n var notFoundContent = _ref.notFoundContent,\n activeIndex = _ref.activeIndex,\n setActiveIndex = _ref.setActiveIndex,\n selectOption = _ref.selectOption,\n onFocus = _ref.onFocus,\n onBlur = _ref.onBlur;\n var _this$props = _this.props,\n prefixCls = _this$props.prefixCls,\n options = _this$props.options;\n var activeOption = options[activeIndex] || {};\n return React.createElement(Menu, {\n prefixCls: \"\".concat(prefixCls, \"-menu\"),\n activeKey: activeOption.key,\n onSelect: function onSelect(_ref2) {\n var key = _ref2.key;\n var option = options.find(function (_ref3) {\n var optionKey = _ref3.key;\n return optionKey === key;\n });\n selectOption(option);\n },\n onFocus: onFocus,\n onBlur: onBlur\n }, options.map(function (option, index) {\n var key = option.key,\n disabled = option.disabled,\n children = option.children,\n className = option.className,\n style = option.style;\n return React.createElement(MenuItem, {\n key: key,\n disabled: disabled,\n className: className,\n style: style,\n onMouseEnter: function onMouseEnter() {\n setActiveIndex(index);\n }\n }, children);\n }), !options.length && React.createElement(MenuItem, {\n disabled: true\n }, notFoundContent));\n };\n\n return _this;\n }\n\n _createClass(DropdownMenu, [{\n key: \"render\",\n value: function render() {\n return React.createElement(MentionsContextConsumer, null, this.renderDropdown);\n }\n }]);\n\n return DropdownMenu;\n}(React.Component);\n\nexport default DropdownMenu;"]},"metadata":{},"sourceType":"module"}