82af12a3d3baff81eea879997e82a805.json
10.7 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/createSuper\";\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { ConfigConsumer } from '../config-provider';\nimport AnchorContext from './context';\n\nvar AnchorLink = /*#__PURE__*/function (_React$Component) {\n _inherits(AnchorLink, _React$Component);\n\n var _super = _createSuper(AnchorLink);\n\n function AnchorLink() {\n var _this;\n\n _classCallCheck(this, AnchorLink);\n\n _this = _super.apply(this, arguments);\n\n _this.handleClick = function (e) {\n var _this$context = _this.context,\n scrollTo = _this$context.scrollTo,\n onClick = _this$context.onClick;\n var _this$props = _this.props,\n href = _this$props.href,\n title = _this$props.title;\n\n if (onClick) {\n onClick(e, {\n title: title,\n href: href\n });\n }\n\n scrollTo(href);\n };\n\n _this.renderAnchorLink = function (_ref) {\n var getPrefixCls = _ref.getPrefixCls;\n var _this$props2 = _this.props,\n customizePrefixCls = _this$props2.prefixCls,\n href = _this$props2.href,\n title = _this$props2.title,\n children = _this$props2.children,\n className = _this$props2.className,\n target = _this$props2.target;\n var prefixCls = getPrefixCls('anchor', customizePrefixCls);\n var active = _this.context.activeLink === href;\n var wrapperClassName = classNames(\"\".concat(prefixCls, \"-link\"), _defineProperty({}, \"\".concat(prefixCls, \"-link-active\"), active), className);\n var titleClassName = classNames(\"\".concat(prefixCls, \"-link-title\"), _defineProperty({}, \"\".concat(prefixCls, \"-link-title-active\"), active));\n return /*#__PURE__*/React.createElement(\"div\", {\n className: wrapperClassName\n }, /*#__PURE__*/React.createElement(\"a\", {\n className: titleClassName,\n href: href,\n title: typeof title === 'string' ? title : '',\n target: target,\n onClick: _this.handleClick\n }, title), children);\n };\n\n return _this;\n }\n\n _createClass(AnchorLink, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.context.registerLink(this.props.href);\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(_ref2) {\n var prevHref = _ref2.href;\n var href = this.props.href;\n\n if (prevHref !== href) {\n this.context.unregisterLink(prevHref);\n this.context.registerLink(href);\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.context.unregisterLink(this.props.href);\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderAnchorLink);\n }\n }]);\n\n return AnchorLink;\n}(React.Component);\n\nAnchorLink.defaultProps = {\n href: '#'\n};\nAnchorLink.contextType = AnchorContext;\nexport default AnchorLink;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/anchor/AnchorLink.js"],"names":["_defineProperty","_classCallCheck","_createClass","_inherits","_createSuper","React","classNames","ConfigConsumer","AnchorContext","AnchorLink","_React$Component","_super","_this","apply","arguments","handleClick","e","_this$context","context","scrollTo","onClick","_this$props","props","href","title","renderAnchorLink","_ref","getPrefixCls","_this$props2","customizePrefixCls","prefixCls","children","className","target","active","activeLink","wrapperClassName","concat","titleClassName","createElement","key","value","componentDidMount","registerLink","componentDidUpdate","_ref2","prevHref","unregisterLink","componentWillUnmount","render","Component","defaultProps","contextType"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,uCAA5B;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,YAAP,MAAyB,oCAAzB;AACA,OAAOC,SAAP,MAAsB,iCAAtB;AACA,OAAOC,YAAP,MAAyB,oCAAzB;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,OAAOC,aAAP,MAA0B,WAA1B;;AAEA,IAAIC,UAAU,GAAG,aAAa,UAAUC,gBAAV,EAA4B;AACxDP,EAAAA,SAAS,C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AACD;AAJuB,GAAD,EAKtB;AACDiB,IAAAA,GAAG,EAAE,oBADJ;AAEDC,IAAAA,KAAK,EAAE,SAASG,kBAAT,CAA4BC,KAA5B,EAAmC;AACxC,UAAIC,QAAQ,GAAGD,KAAK,CAACtB,IAArB;AACA,UAAIA,IAAI,GAAG,KAAKD,KAAL,CAAWC,IAAtB;;AAEA,UAAIuB,QAAQ,KAAKvB,IAAjB,EAAuB;AACrB,aAAKL,OAAL,CAAa6B,cAAb,CAA4BD,QAA5B;AACA,aAAK5B,OAAL,CAAayB,YAAb,CAA0BpB,IAA1B;AACD;AACF;AAVA,GALsB,EAgBtB;AACDiB,IAAAA,GAAG,EAAE,sBADJ;AAEDC,IAAAA,KAAK,EAAE,SAASO,oBAAT,GAAgC;AACrC,WAAK9B,OAAL,CAAa6B,cAAb,CAA4B,KAAKzB,KAAL,CAAWC,IAAvC;AACD;AAJA,GAhBsB,EAqBtB;AACDiB,IAAAA,GAAG,EAAE,QADJ;AAEDC,IAAAA,KAAK,EAAE,SAASQ,MAAT,GAAkB;AACvB,aAAO,aAAa5C,KAAK,CAACkC,aAAN,CAAoBhC,cAApB,EAAoC,IAApC,EAA0C,KAAKkB,gBAA/C,CAApB;AACD;AAJA,GArBsB,CAAb,CAAZ;;AA4BA,SAAOhB,UAAP;AACD,CAtF6B,CAsF5BJ,KAAK,CAAC6C,SAtFsB,CAA9B;;AAwFAzC,UAAU,CAAC0C,YAAX,GAA0B;AACxB5B,EAAAA,IAAI,EAAE;AADkB,CAA1B;AAGAd,UAAU,CAAC2C,WAAX,GAAyB5C,aAAzB;AACA,eAAeC,UAAf","sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/createSuper\";\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { ConfigConsumer } from '../config-provider';\nimport AnchorContext from './context';\n\nvar AnchorLink = /*#__PURE__*/function (_React$Component) {\n _inherits(AnchorLink, _React$Component);\n\n var _super = _createSuper(AnchorLink);\n\n function AnchorLink() {\n var _this;\n\n _classCallCheck(this, AnchorLink);\n\n _this = _super.apply(this, arguments);\n\n _this.handleClick = function (e) {\n var _this$context = _this.context,\n scrollTo = _this$context.scrollTo,\n onClick = _this$context.onClick;\n var _this$props = _this.props,\n href = _this$props.href,\n title = _this$props.title;\n\n if (onClick) {\n onClick(e, {\n title: title,\n href: href\n });\n }\n\n scrollTo(href);\n };\n\n _this.renderAnchorLink = function (_ref) {\n var getPrefixCls = _ref.getPrefixCls;\n var _this$props2 = _this.props,\n customizePrefixCls = _this$props2.prefixCls,\n href = _this$props2.href,\n title = _this$props2.title,\n children = _this$props2.children,\n className = _this$props2.className,\n target = _this$props2.target;\n var prefixCls = getPrefixCls('anchor', customizePrefixCls);\n var active = _this.context.activeLink === href;\n var wrapperClassName = classNames(\"\".concat(prefixCls, \"-link\"), _defineProperty({}, \"\".concat(prefixCls, \"-link-active\"), active), className);\n var titleClassName = classNames(\"\".concat(prefixCls, \"-link-title\"), _defineProperty({}, \"\".concat(prefixCls, \"-link-title-active\"), active));\n return /*#__PURE__*/React.createElement(\"div\", {\n className: wrapperClassName\n }, /*#__PURE__*/React.createElement(\"a\", {\n className: titleClassName,\n href: href,\n title: typeof title === 'string' ? title : '',\n target: target,\n onClick: _this.handleClick\n }, title), children);\n };\n\n return _this;\n }\n\n _createClass(AnchorLink, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n this.context.registerLink(this.props.href);\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate(_ref2) {\n var prevHref = _ref2.href;\n var href = this.props.href;\n\n if (prevHref !== href) {\n this.context.unregisterLink(prevHref);\n this.context.registerLink(href);\n }\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n this.context.unregisterLink(this.props.href);\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderAnchorLink);\n }\n }]);\n\n return AnchorLink;\n}(React.Component);\n\nAnchorLink.defaultProps = {\n href: '#'\n};\nAnchorLink.contextType = AnchorContext;\nexport default AnchorLink;"]},"metadata":{},"sourceType":"module"}