e76d185d01b0f28fce1ce60b0bd15aae.json
10.9 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/extends\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\nimport * as React from 'react';\nimport RcCheckbox from 'rc-checkbox';\nimport classNames from 'classnames';\nimport { composeRef } from \"rc-util/es/ref\";\nimport { ConfigContext } from '../config-provider';\nimport RadioGroupContext from './context';\nimport devWarning from '../_util/devWarning';\n\nvar InternalRadio = function InternalRadio(props, ref) {\n var _classNames;\n\n var context = React.useContext(RadioGroupContext);\n\n var _React$useContext = React.useContext(ConfigContext),\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction;\n\n var innerRef = React.useRef();\n var mergedRef = composeRef(ref, innerRef);\n React.useEffect(function () {\n devWarning(!('optionType' in props), 'Radio', '`optionType` is only support in Radio.Group.');\n }, []);\n\n var onChange = function onChange(e) {\n if (props.onChange) {\n props.onChange(e);\n }\n\n if (context === null || context === void 0 ? void 0 : context.onChange) {\n context.onChange(e);\n }\n };\n\n var customizePrefixCls = props.prefixCls,\n className = props.className,\n children = props.children,\n style = props.style,\n restProps = __rest(props, [\"prefixCls\", \"className\", \"children\", \"style\"]);\n\n var prefixCls = getPrefixCls('radio', customizePrefixCls);\n\n var radioProps = _extends({}, restProps);\n\n if (context) {\n radioProps.name = context.name;\n radioProps.onChange = onChange;\n radioProps.checked = props.value === context.value;\n radioProps.disabled = props.disabled || context.disabled;\n }\n\n var wrapperClassString = classNames(\"\".concat(prefixCls, \"-wrapper\"), (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-wrapper-checked\"), radioProps.checked), _defineProperty(_classNames, \"\".concat(prefixCls, \"-wrapper-disabled\"), radioProps.disabled), _defineProperty(_classNames, \"\".concat(prefixCls, \"-wrapper-rtl\"), direction === 'rtl'), _classNames), className);\n return (\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n React.createElement(\"label\", {\n className: wrapperClassString,\n style: style,\n onMouseEnter: props.onMouseEnter,\n onMouseLeave: props.onMouseLeave\n }, /*#__PURE__*/React.createElement(RcCheckbox, _extends({}, radioProps, {\n prefixCls: prefixCls,\n ref: mergedRef\n })), children !== undefined ? /*#__PURE__*/React.createElement(\"span\", null, children) : null)\n );\n};\n\nvar Radio = /*#__PURE__*/React.forwardRef(InternalRadio);\nRadio.displayName = 'Radio';\nRadio.defaultProps = {\n type: 'radio'\n};\nexport default Radio;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/radio/radio.js"],"names":["_defineProperty","_extends","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","RcCheckbox","classNames","composeRef","ConfigContext","RadioGroupContext","devWarning","InternalRadio","props","ref","_classNames","context","useContext","_React$useContext","getPrefixCls","direction","innerRef","useRef","mergedRef","useEffect","onChange","customizePrefixCls","prefixCls","className","children","style","restProps","radioProps","name","checked","value","disabled","wrapperClassString","concat","createElement","onMouseEnter","onMouseLeave","undefined","Radio","forwardRef","displayName","defaultProps","type"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,uCAA5B;AACA,OAAOC,QAAP,MAAqB,gCAArB;;AAEA,IAAIC,MAAM,GAAG,QAAQ,KAAKA,MAAb,IAAuB,UAAUC,CAAV,EAAaC,CAAb,EAAgB;AAClD,MAAIC,CAAC,GAAG,EAAR;;AAEA,OAAK,IAAIC,CAAT,IAAcH,CAAd,EAAiB;AACf,Q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,QAAQ,KAAKa,SAAb,GAAyB,aAAarC,KAAK,CAACkC,aAAN,CAAoB,MAApB,EAA4B,IAA5B,EAAkCV,QAAlC,CAAtC,GAAoF,IARzF;AAHF;AAaD,CAxDD;;AA0DA,IAAIc,KAAK,GAAG,aAAatC,KAAK,CAACuC,UAAN,CAAiBhC,aAAjB,CAAzB;AACA+B,KAAK,CAACE,WAAN,GAAoB,OAApB;AACAF,KAAK,CAACG,YAAN,GAAqB;AACnBC,EAAAA,IAAI,EAAE;AADa,CAArB;AAGA,eAAeJ,KAAf","sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/extends\";\n\nvar __rest = this && this.__rest || function (s, e) {\n var t = {};\n\n for (var p in s) {\n if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];\n }\n\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];\n }\n return t;\n};\n\nimport * as React from 'react';\nimport RcCheckbox from 'rc-checkbox';\nimport classNames from 'classnames';\nimport { composeRef } from \"rc-util/es/ref\";\nimport { ConfigContext } from '../config-provider';\nimport RadioGroupContext from './context';\nimport devWarning from '../_util/devWarning';\n\nvar InternalRadio = function InternalRadio(props, ref) {\n var _classNames;\n\n var context = React.useContext(RadioGroupContext);\n\n var _React$useContext = React.useContext(ConfigContext),\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction;\n\n var innerRef = React.useRef();\n var mergedRef = composeRef(ref, innerRef);\n React.useEffect(function () {\n devWarning(!('optionType' in props), 'Radio', '`optionType` is only support in Radio.Group.');\n }, []);\n\n var onChange = function onChange(e) {\n if (props.onChange) {\n props.onChange(e);\n }\n\n if (context === null || context === void 0 ? void 0 : context.onChange) {\n context.onChange(e);\n }\n };\n\n var customizePrefixCls = props.prefixCls,\n className = props.className,\n children = props.children,\n style = props.style,\n restProps = __rest(props, [\"prefixCls\", \"className\", \"children\", \"style\"]);\n\n var prefixCls = getPrefixCls('radio', customizePrefixCls);\n\n var radioProps = _extends({}, restProps);\n\n if (context) {\n radioProps.name = context.name;\n radioProps.onChange = onChange;\n radioProps.checked = props.value === context.value;\n radioProps.disabled = props.disabled || context.disabled;\n }\n\n var wrapperClassString = classNames(\"\".concat(prefixCls, \"-wrapper\"), (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-wrapper-checked\"), radioProps.checked), _defineProperty(_classNames, \"\".concat(prefixCls, \"-wrapper-disabled\"), radioProps.disabled), _defineProperty(_classNames, \"\".concat(prefixCls, \"-wrapper-rtl\"), direction === 'rtl'), _classNames), className);\n return (\n /*#__PURE__*/\n // eslint-disable-next-line jsx-a11y/label-has-associated-control\n React.createElement(\"label\", {\n className: wrapperClassString,\n style: style,\n onMouseEnter: props.onMouseEnter,\n onMouseLeave: props.onMouseLeave\n }, /*#__PURE__*/React.createElement(RcCheckbox, _extends({}, radioProps, {\n prefixCls: prefixCls,\n ref: mergedRef\n })), children !== undefined ? /*#__PURE__*/React.createElement(\"span\", null, children) : null)\n );\n};\n\nvar Radio = /*#__PURE__*/React.forwardRef(InternalRadio);\nRadio.displayName = 'Radio';\nRadio.defaultProps = {\n type: 'radio'\n};\nexport default Radio;"]},"metadata":{},"sourceType":"module"}