aed21df12f4284080a4a82e508cde595.json
12.1 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 React from 'react';\n\nvar Star = /*#__PURE__*/function (_React$Component) {\n _inherits(Star, _React$Component);\n\n var _super = _createSuper(Star);\n\n function Star() {\n var _this;\n\n _classCallCheck(this, Star);\n\n _this = _super.apply(this, arguments);\n\n _this.onHover = function (e) {\n var _this$props = _this.props,\n onHover = _this$props.onHover,\n index = _this$props.index;\n onHover(e, index);\n };\n\n _this.onClick = function (e) {\n var _this$props2 = _this.props,\n onClick = _this$props2.onClick,\n index = _this$props2.index;\n onClick(e, index);\n };\n\n _this.onKeyDown = function (e) {\n var _this$props3 = _this.props,\n onClick = _this$props3.onClick,\n index = _this$props3.index;\n\n if (e.keyCode === 13) {\n onClick(e, index);\n }\n };\n\n return _this;\n }\n\n _createClass(Star, [{\n key: \"getClassName\",\n value: function getClassName() {\n var _this$props4 = this.props,\n prefixCls = _this$props4.prefixCls,\n index = _this$props4.index,\n value = _this$props4.value,\n allowHalf = _this$props4.allowHalf,\n focused = _this$props4.focused;\n var starValue = index + 1;\n var className = prefixCls;\n\n if (value === 0 && index === 0 && focused) {\n className += \" \".concat(prefixCls, \"-focused\");\n } else if (allowHalf && value + 0.5 >= starValue && value < starValue) {\n className += \" \".concat(prefixCls, \"-half \").concat(prefixCls, \"-active\");\n\n if (focused) {\n className += \" \".concat(prefixCls, \"-focused\");\n }\n } else {\n className += starValue <= value ? \" \".concat(prefixCls, \"-full\") : \" \".concat(prefixCls, \"-zero\");\n\n if (starValue === value && focused) {\n className += \" \".concat(prefixCls, \"-focused\");\n }\n }\n\n return className;\n }\n }, {\n key: \"render\",\n value: function render() {\n var onHover = this.onHover,\n onClick = this.onClick,\n onKeyDown = this.onKeyDown;\n var _this$props5 = this.props,\n disabled = _this$props5.disabled,\n prefixCls = _this$props5.prefixCls,\n character = _this$props5.character,\n characterRender = _this$props5.characterRender,\n index = _this$props5.index,\n count = _this$props5.count,\n value = _this$props5.value;\n var characterNode = typeof character === 'function' ? character(this.props) : character;\n var start = /*#__PURE__*/React.createElement(\"li\", {\n className: this.getClassName()\n }, /*#__PURE__*/React.createElement(\"div\", {\n onClick: disabled ? null : onClick,\n onKeyDown: disabled ? null : onKeyDown,\n onMouseMove: disabled ? null : onHover,\n role: \"radio\",\n \"aria-checked\": value > index ? 'true' : 'false',\n \"aria-posinset\": index + 1,\n \"aria-setsize\": count,\n tabIndex: disabled ? -1 : 0\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-first\")\n }, characterNode), /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-second\")\n }, characterNode)));\n\n if (characterRender) {\n start = characterRender(start, this.props);\n }\n\n return start;\n }\n }]);\n\n return Star;\n}(React.Component);\n\nexport { Star as default };","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-rate/es/Star.js"],"names":["_classCallCheck","_createClass","_inherits","_createSuper","React","Star","_React$Component","_super","_this","apply","arguments","onHover","e","_this$props","props","index","onClick","_this$props2","onKeyDown","_this$props3","keyCode","key","value","getClassName","_this$props4","prefixCls","allowHalf","focused","starValue","className","concat","render","_this$props5","disabled","character","characterRender","count","characterNode","start","createElement","onMouseMove","role","tabIndex","Component","default"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,2CAA5B;AACA,OAAOC,YAAP,MAAyB,wCAAzB;AACA,OAAOC,SAAP,MAAsB,qCAAtB;AACA,OAAOC,YAAP,MAAyB,wCAAzB;AACA,OAAOC,KAAP,MAAkB,OAAlB;;AAEA,IAAIC,IAAI,GAAG,aAAa,UAAUC,gBAAV,EAA4B;AAClDJ,EAAAA,SAAS,CAACG,IAAD,EAAOC,gBAAP,CAAT;;AAE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7B,KAAK,CAACmC,aAAN,CAAoB,KAApB,EAA2B;AACzCV,QAAAA,SAAS,EAAE,GAAGC,MAAH,CAAUL,SAAV,EAAqB,QAArB;AAD8B,OAA3B,EAEbY,aAFa,CATA,EAWG,aAAajC,KAAK,CAACmC,aAAN,CAAoB,KAApB,EAA2B;AACzDV,QAAAA,SAAS,EAAE,GAAGC,MAAH,CAAUL,SAAV,EAAqB,SAArB;AAD8C,OAA3B,EAE7BY,aAF6B,CAXhB,CAFS,CAAzB;;AAiBA,UAAIF,eAAJ,EAAqB;AACnBG,QAAAA,KAAK,GAAGH,eAAe,CAACG,KAAD,EAAQ,KAAKxB,KAAb,CAAvB;AACD;;AAED,aAAOwB,KAAP;AACD;AArCA,GA9BgB,CAAP,CAAZ;;AAsEA,SAAOjC,IAAP;AACD,CA9GuB,CA8GtBD,KAAK,CAACuC,SA9GgB,CAAxB;;AAgHA,SAAStC,IAAI,IAAIuC,OAAjB","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 React from 'react';\n\nvar Star = /*#__PURE__*/function (_React$Component) {\n _inherits(Star, _React$Component);\n\n var _super = _createSuper(Star);\n\n function Star() {\n var _this;\n\n _classCallCheck(this, Star);\n\n _this = _super.apply(this, arguments);\n\n _this.onHover = function (e) {\n var _this$props = _this.props,\n onHover = _this$props.onHover,\n index = _this$props.index;\n onHover(e, index);\n };\n\n _this.onClick = function (e) {\n var _this$props2 = _this.props,\n onClick = _this$props2.onClick,\n index = _this$props2.index;\n onClick(e, index);\n };\n\n _this.onKeyDown = function (e) {\n var _this$props3 = _this.props,\n onClick = _this$props3.onClick,\n index = _this$props3.index;\n\n if (e.keyCode === 13) {\n onClick(e, index);\n }\n };\n\n return _this;\n }\n\n _createClass(Star, [{\n key: \"getClassName\",\n value: function getClassName() {\n var _this$props4 = this.props,\n prefixCls = _this$props4.prefixCls,\n index = _this$props4.index,\n value = _this$props4.value,\n allowHalf = _this$props4.allowHalf,\n focused = _this$props4.focused;\n var starValue = index + 1;\n var className = prefixCls;\n\n if (value === 0 && index === 0 && focused) {\n className += \" \".concat(prefixCls, \"-focused\");\n } else if (allowHalf && value + 0.5 >= starValue && value < starValue) {\n className += \" \".concat(prefixCls, \"-half \").concat(prefixCls, \"-active\");\n\n if (focused) {\n className += \" \".concat(prefixCls, \"-focused\");\n }\n } else {\n className += starValue <= value ? \" \".concat(prefixCls, \"-full\") : \" \".concat(prefixCls, \"-zero\");\n\n if (starValue === value && focused) {\n className += \" \".concat(prefixCls, \"-focused\");\n }\n }\n\n return className;\n }\n }, {\n key: \"render\",\n value: function render() {\n var onHover = this.onHover,\n onClick = this.onClick,\n onKeyDown = this.onKeyDown;\n var _this$props5 = this.props,\n disabled = _this$props5.disabled,\n prefixCls = _this$props5.prefixCls,\n character = _this$props5.character,\n characterRender = _this$props5.characterRender,\n index = _this$props5.index,\n count = _this$props5.count,\n value = _this$props5.value;\n var characterNode = typeof character === 'function' ? character(this.props) : character;\n var start = /*#__PURE__*/React.createElement(\"li\", {\n className: this.getClassName()\n }, /*#__PURE__*/React.createElement(\"div\", {\n onClick: disabled ? null : onClick,\n onKeyDown: disabled ? null : onKeyDown,\n onMouseMove: disabled ? null : onHover,\n role: \"radio\",\n \"aria-checked\": value > index ? 'true' : 'false',\n \"aria-posinset\": index + 1,\n \"aria-setsize\": count,\n tabIndex: disabled ? -1 : 0\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-first\")\n }, characterNode), /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-second\")\n }, characterNode)));\n\n if (characterRender) {\n start = characterRender(start, this.props);\n }\n\n return start;\n }\n }]);\n\n return Star;\n}(React.Component);\n\nexport { Star as default };"]},"metadata":{},"sourceType":"module"}