ba435ea076c14aa8c1391cc91f2aefa7.json 29.5 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _typeof from \"@babel/runtime/helpers/typeof\";\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/* eslint-disable react/button-has-type */\n\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport Group from './button-group';\nimport { ConfigContext } from '../config-provider';\nimport Wave from '../_util/wave';\nimport { tuple } from '../_util/type';\nimport devWarning from '../_util/devWarning';\nimport SizeContext from '../config-provider/SizeContext';\nimport LoadingIcon from './LoadingIcon';\nimport { cloneElement } from '../_util/reactNode';\nvar rxTwoCNChar = /^[\\u4e00-\\u9fa5]{2}$/;\nvar isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);\n\nfunction isString(str) {\n  return typeof str === 'string';\n}\n\nfunction isUnborderedButtonType(type) {\n  return type === 'text' || type === 'link';\n} // Insert one space between two chinese characters automatically.\n\n\nfunction insertSpace(child, needInserted) {\n  // Check the child if is undefined or null.\n  if (child == null) {\n    return;\n  }\n\n  var SPACE = needInserted ? ' ' : ''; // strictNullChecks oops.\n\n  if (typeof child !== 'string' && typeof child !== 'number' && isString(child.type) && isTwoCNChar(child.props.children)) {\n    return cloneElement(child, {\n      children: child.props.children.split('').join(SPACE)\n    });\n  }\n\n  if (typeof child === 'string') {\n    if (isTwoCNChar(child)) {\n      child = child.split('').join(SPACE);\n    }\n\n    return /*#__PURE__*/React.createElement(\"span\", null, child);\n  }\n\n  return child;\n}\n\nfunction spaceChildren(children, needInserted) {\n  var isPrevChildPure = false;\n  var childList = [];\n  React.Children.forEach(children, function (child) {\n    var type = _typeof(child);\n\n    var isCurrentChildPure = type === 'string' || type === 'number';\n\n    if (isPrevChildPure && isCurrentChildPure) {\n      var lastIndex = childList.length - 1;\n      var lastChild = childList[lastIndex];\n      childList[lastIndex] = \"\".concat(lastChild).concat(child);\n    } else {\n      childList.push(child);\n    }\n\n    isPrevChildPure = isCurrentChildPure;\n  }); // Pass to React.Children.map to auto fill key\n\n  return React.Children.map(childList, function (child) {\n    return insertSpace(child, needInserted);\n  });\n}\n\nvar ButtonTypes = tuple('default', 'primary', 'ghost', 'dashed', 'link', 'text');\nvar ButtonShapes = tuple('circle', 'round');\nvar ButtonHTMLTypes = tuple('submit', 'button', 'reset');\nexport function convertLegacyProps(type) {\n  if (type === 'danger') {\n    return {\n      danger: true\n    };\n  }\n\n  return {\n    type: type\n  };\n}\n\nvar InternalButton = function InternalButton(props, ref) {\n  var _classNames;\n\n  var _props$loading = props.loading,\n      loading = _props$loading === void 0 ? false : _props$loading,\n      customizePrefixCls = props.prefixCls,\n      type = props.type,\n      danger = props.danger,\n      shape = props.shape,\n      customizeSize = props.size,\n      className = props.className,\n      children = props.children,\n      icon = props.icon,\n      _props$ghost = props.ghost,\n      ghost = _props$ghost === void 0 ? false : _props$ghost,\n      _props$block = props.block,\n      block = _props$block === void 0 ? false : _props$block,\n      _props$htmlType = props.htmlType,\n      htmlType = _props$htmlType === void 0 ? 'button' : _props$htmlType,\n      rest = __rest(props, [\"loading\", \"prefixCls\", \"type\", \"danger\", \"shape\", \"size\", \"className\", \"children\", \"icon\", \"ghost\", \"block\", \"htmlType\"]);\n\n  var size = React.useContext(SizeContext);\n\n  var _React$useState = React.useState(!!loading),\n      _React$useState2 = _slicedToArray(_React$useState, 2),\n      innerLoading = _React$useState2[0],\n      setLoading = _React$useState2[1];\n\n  var _React$useState3 = React.useState(false),\n      _React$useState4 = _slicedToArray(_React$useState3, 2),\n      hasTwoCNChar = _React$useState4[0],\n      setHasTwoCNChar = _React$useState4[1];\n\n  var _React$useContext = React.useContext(ConfigContext),\n      getPrefixCls = _React$useContext.getPrefixCls,\n      autoInsertSpaceInButton = _React$useContext.autoInsertSpaceInButton,\n      direction = _React$useContext.direction;\n\n  var buttonRef = ref || /*#__PURE__*/React.createRef();\n  var delayTimeoutRef = React.useRef();\n\n  var isNeedInserted = function isNeedInserted() {\n    return React.Children.count(children) === 1 && !icon && !isUnborderedButtonType(type);\n  };\n\n  var fixTwoCNChar = function fixTwoCNChar() {\n    // Fix for HOC usage like <FormatMessage />\n    if (!buttonRef || !buttonRef.current || autoInsertSpaceInButton === false) {\n      return;\n    }\n\n    var buttonText = buttonRef.current.textContent;\n\n    if (isNeedInserted() && isTwoCNChar(buttonText)) {\n      if (!hasTwoCNChar) {\n        setHasTwoCNChar(true);\n      }\n    } else if (hasTwoCNChar) {\n      setHasTwoCNChar(false);\n    }\n  }; // =============== Update Loading ===============\n\n\n  var loadingOrDelay;\n\n  if (_typeof(loading) === 'object' && loading.delay) {\n    loadingOrDelay = loading.delay || true;\n  } else {\n    loadingOrDelay = !!loading;\n  }\n\n  React.useEffect(function () {\n    clearTimeout(delayTimeoutRef.current);\n\n    if (typeof loadingOrDelay === 'number') {\n      delayTimeoutRef.current = window.setTimeout(function () {\n        setLoading(loadingOrDelay);\n      }, loadingOrDelay);\n    } else {\n      setLoading(loadingOrDelay);\n    }\n  }, [loadingOrDelay]);\n  React.useEffect(fixTwoCNChar, [buttonRef]);\n\n  var handleClick = function handleClick(e) {\n    var onClick = props.onClick;\n\n    if (innerLoading) {\n      return;\n    }\n\n    if (onClick) {\n      onClick(e);\n    }\n  };\n\n  devWarning(!(typeof icon === 'string' && icon.length > 2), 'Button', \"`icon` is using ReactNode instead of string naming in v4. Please check `\".concat(icon, \"` at https://ant.design/components/icon\"));\n  devWarning(!(ghost && isUnborderedButtonType(type)), 'Button', \"`link` or `text` button can't be a `ghost` button.\");\n  var prefixCls = getPrefixCls('btn', customizePrefixCls);\n  var autoInsertSpace = autoInsertSpaceInButton !== false; // large => lg\n  // small => sm\n\n  var sizeCls = '';\n\n  switch (customizeSize || size) {\n    case 'large':\n      sizeCls = 'lg';\n      break;\n\n    case 'small':\n      sizeCls = 'sm';\n      break;\n\n    default:\n      break;\n  }\n\n  var iconType = innerLoading ? 'loading' : icon;\n  var classes = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(type), type), _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(shape), shape), _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(sizeCls), sizeCls), _defineProperty(_classNames, \"\".concat(prefixCls, \"-icon-only\"), !children && children !== 0 && iconType), _defineProperty(_classNames, \"\".concat(prefixCls, \"-background-ghost\"), ghost && !isUnborderedButtonType(type)), _defineProperty(_classNames, \"\".concat(prefixCls, \"-loading\"), innerLoading), _defineProperty(_classNames, \"\".concat(prefixCls, \"-two-chinese-chars\"), hasTwoCNChar && autoInsertSpace), _defineProperty(_classNames, \"\".concat(prefixCls, \"-block\"), block), _defineProperty(_classNames, \"\".concat(prefixCls, \"-dangerous\"), !!danger), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _classNames), className);\n  var iconNode = icon && !innerLoading ? icon : /*#__PURE__*/React.createElement(LoadingIcon, {\n    existIcon: !!icon,\n    prefixCls: prefixCls,\n    loading: !!innerLoading\n  });\n  var kids = children || children === 0 ? spaceChildren(children, isNeedInserted() && autoInsertSpace) : null;\n  var linkButtonRestProps = omit(rest, ['navigate']);\n\n  if (linkButtonRestProps.href !== undefined) {\n    return /*#__PURE__*/React.createElement(\"a\", _extends({}, linkButtonRestProps, {\n      className: classes,\n      onClick: handleClick,\n      ref: buttonRef\n    }), iconNode, kids);\n  }\n\n  var buttonNode = /*#__PURE__*/React.createElement(\"button\", _extends({}, rest, {\n    type: htmlType,\n    className: classes,\n    onClick: handleClick,\n    ref: buttonRef\n  }), iconNode, kids);\n\n  if (isUnborderedButtonType(type)) {\n    return buttonNode;\n  }\n\n  return /*#__PURE__*/React.createElement(Wave, null, buttonNode);\n};\n\nvar Button = /*#__PURE__*/React.forwardRef(InternalButton);\nButton.displayName = 'Button';\nButton.Group = Group;\nButton.__ANT_BUTTON = true;\nexport default Button;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/button/button.js"],"names":["_extends","_defineProperty","_slicedToArray","_typeof","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","classNames","omit","Group","ConfigContext","Wave","tuple","devWarning","SizeContext","LoadingIcon","cloneElement","rxTwoCNChar","isTwoCNChar","test","bind","isString","str","isUnborderedButtonType","type","insertSpace","child","needInserted","SPACE","props","children","split","join","createElement","spaceChildren","isPrevChildPure","childList","Children","forEach","isCurrentChildPure","lastIndex","lastChild","concat","push","map","ButtonTypes","ButtonShapes","ButtonHTMLTypes","convertLegacyProps","danger","InternalButton","ref","_classNames","_props$loading","loading","customizePrefixCls","prefixCls","shape","customizeSize","size","className","icon","_props$ghost","ghost","_props$block","block","_props$htmlType","htmlType","rest","useContext","_React$useState","useState","_React$useState2","innerLoading","setLoading","_React$useState3","_React$useState4","hasTwoCNChar","setHasTwoCNChar","_React$useContext","getPrefixCls","autoInsertSpaceInButton","direction","buttonRef","createRef","delayTimeoutRef","useRef","isNeedInserted","count","fixTwoCNChar","current","buttonText","textContent","loadingOrDelay","delay","useEffect","clearTimeout","window","setTimeout","handleClick","onClick","autoInsertSpace","sizeCls","iconType","classes","iconNode","existIcon","kids","linkButtonRestProps","href","undefined","buttonNode","Button","forwardRef","displayName","__ANT_BUTTON"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;AACA,OAAOC,eAAP,MAA4B,uCA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AOuF,UAAP;AACD;;AAED,SAAO,aAAazG,KAAK,CAAC2B,aAAN,CAAoBtB,IAApB,EAA0B,IAA1B,EAAgCoG,UAAhC,CAApB;AACD,CAnJD;;AAqJA,IAAIC,MAAM,GAAG,aAAa1G,KAAK,CAAC2G,UAAN,CAAiB/D,cAAjB,CAA1B;AACA8D,MAAM,CAACE,WAAP,GAAqB,QAArB;AACAF,MAAM,CAACvG,KAAP,GAAeA,KAAf;AACAuG,MAAM,CAACG,YAAP,GAAsB,IAAtB;AACA,eAAeH,MAAf","sourcesContent":["import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\nimport _typeof from \"@babel/runtime/helpers/typeof\";\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/* eslint-disable react/button-has-type */\n\n\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport Group from './button-group';\nimport { ConfigContext } from '../config-provider';\nimport Wave from '../_util/wave';\nimport { tuple } from '../_util/type';\nimport devWarning from '../_util/devWarning';\nimport SizeContext from '../config-provider/SizeContext';\nimport LoadingIcon from './LoadingIcon';\nimport { cloneElement } from '../_util/reactNode';\nvar rxTwoCNChar = /^[\\u4e00-\\u9fa5]{2}$/;\nvar isTwoCNChar = rxTwoCNChar.test.bind(rxTwoCNChar);\n\nfunction isString(str) {\n  return typeof str === 'string';\n}\n\nfunction isUnborderedButtonType(type) {\n  return type === 'text' || type === 'link';\n} // Insert one space between two chinese characters automatically.\n\n\nfunction insertSpace(child, needInserted) {\n  // Check the child if is undefined or null.\n  if (child == null) {\n    return;\n  }\n\n  var SPACE = needInserted ? ' ' : ''; // strictNullChecks oops.\n\n  if (typeof child !== 'string' && typeof child !== 'number' && isString(child.type) && isTwoCNChar(child.props.children)) {\n    return cloneElement(child, {\n      children: child.props.children.split('').join(SPACE)\n    });\n  }\n\n  if (typeof child === 'string') {\n    if (isTwoCNChar(child)) {\n      child = child.split('').join(SPACE);\n    }\n\n    return /*#__PURE__*/React.createElement(\"span\", null, child);\n  }\n\n  return child;\n}\n\nfunction spaceChildren(children, needInserted) {\n  var isPrevChildPure = false;\n  var childList = [];\n  React.Children.forEach(children, function (child) {\n    var type = _typeof(child);\n\n    var isCurrentChildPure = type === 'string' || type === 'number';\n\n    if (isPrevChildPure && isCurrentChildPure) {\n      var lastIndex = childList.length - 1;\n      var lastChild = childList[lastIndex];\n      childList[lastIndex] = \"\".concat(lastChild).concat(child);\n    } else {\n      childList.push(child);\n    }\n\n    isPrevChildPure = isCurrentChildPure;\n  }); // Pass to React.Children.map to auto fill key\n\n  return React.Children.map(childList, function (child) {\n    return insertSpace(child, needInserted);\n  });\n}\n\nvar ButtonTypes = tuple('default', 'primary', 'ghost', 'dashed', 'link', 'text');\nvar ButtonShapes = tuple('circle', 'round');\nvar ButtonHTMLTypes = tuple('submit', 'button', 'reset');\nexport function convertLegacyProps(type) {\n  if (type === 'danger') {\n    return {\n      danger: true\n    };\n  }\n\n  return {\n    type: type\n  };\n}\n\nvar InternalButton = function InternalButton(props, ref) {\n  var _classNames;\n\n  var _props$loading = props.loading,\n      loading = _props$loading === void 0 ? false : _props$loading,\n      customizePrefixCls = props.prefixCls,\n      type = props.type,\n      danger = props.danger,\n      shape = props.shape,\n      customizeSize = props.size,\n      className = props.className,\n      children = props.children,\n      icon = props.icon,\n      _props$ghost = props.ghost,\n      ghost = _props$ghost === void 0 ? false : _props$ghost,\n      _props$block = props.block,\n      block = _props$block === void 0 ? false : _props$block,\n      _props$htmlType = props.htmlType,\n      htmlType = _props$htmlType === void 0 ? 'button' : _props$htmlType,\n      rest = __rest(props, [\"loading\", \"prefixCls\", \"type\", \"danger\", \"shape\", \"size\", \"className\", \"children\", \"icon\", \"ghost\", \"block\", \"htmlType\"]);\n\n  var size = React.useContext(SizeContext);\n\n  var _React$useState = React.useState(!!loading),\n      _React$useState2 = _slicedToArray(_React$useState, 2),\n      innerLoading = _React$useState2[0],\n      setLoading = _React$useState2[1];\n\n  var _React$useState3 = React.useState(false),\n      _React$useState4 = _slicedToArray(_React$useState3, 2),\n      hasTwoCNChar = _React$useState4[0],\n      setHasTwoCNChar = _React$useState4[1];\n\n  var _React$useContext = React.useContext(ConfigContext),\n      getPrefixCls = _React$useContext.getPrefixCls,\n      autoInsertSpaceInButton = _React$useContext.autoInsertSpaceInButton,\n      direction = _React$useContext.direction;\n\n  var buttonRef = ref || /*#__PURE__*/React.createRef();\n  var delayTimeoutRef = React.useRef();\n\n  var isNeedInserted = function isNeedInserted() {\n    return React.Children.count(children) === 1 && !icon && !isUnborderedButtonType(type);\n  };\n\n  var fixTwoCNChar = function fixTwoCNChar() {\n    // Fix for HOC usage like <FormatMessage />\n    if (!buttonRef || !buttonRef.current || autoInsertSpaceInButton === false) {\n      return;\n    }\n\n    var buttonText = buttonRef.current.textContent;\n\n    if (isNeedInserted() && isTwoCNChar(buttonText)) {\n      if (!hasTwoCNChar) {\n        setHasTwoCNChar(true);\n      }\n    } else if (hasTwoCNChar) {\n      setHasTwoCNChar(false);\n    }\n  }; // =============== Update Loading ===============\n\n\n  var loadingOrDelay;\n\n  if (_typeof(loading) === 'object' && loading.delay) {\n    loadingOrDelay = loading.delay || true;\n  } else {\n    loadingOrDelay = !!loading;\n  }\n\n  React.useEffect(function () {\n    clearTimeout(delayTimeoutRef.current);\n\n    if (typeof loadingOrDelay === 'number') {\n      delayTimeoutRef.current = window.setTimeout(function () {\n        setLoading(loadingOrDelay);\n      }, loadingOrDelay);\n    } else {\n      setLoading(loadingOrDelay);\n    }\n  }, [loadingOrDelay]);\n  React.useEffect(fixTwoCNChar, [buttonRef]);\n\n  var handleClick = function handleClick(e) {\n    var onClick = props.onClick;\n\n    if (innerLoading) {\n      return;\n    }\n\n    if (onClick) {\n      onClick(e);\n    }\n  };\n\n  devWarning(!(typeof icon === 'string' && icon.length > 2), 'Button', \"`icon` is using ReactNode instead of string naming in v4. Please check `\".concat(icon, \"` at https://ant.design/components/icon\"));\n  devWarning(!(ghost && isUnborderedButtonType(type)), 'Button', \"`link` or `text` button can't be a `ghost` button.\");\n  var prefixCls = getPrefixCls('btn', customizePrefixCls);\n  var autoInsertSpace = autoInsertSpaceInButton !== false; // large => lg\n  // small => sm\n\n  var sizeCls = '';\n\n  switch (customizeSize || size) {\n    case 'large':\n      sizeCls = 'lg';\n      break;\n\n    case 'small':\n      sizeCls = 'sm';\n      break;\n\n    default:\n      break;\n  }\n\n  var iconType = innerLoading ? 'loading' : icon;\n  var classes = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(type), type), _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(shape), shape), _defineProperty(_classNames, \"\".concat(prefixCls, \"-\").concat(sizeCls), sizeCls), _defineProperty(_classNames, \"\".concat(prefixCls, \"-icon-only\"), !children && children !== 0 && iconType), _defineProperty(_classNames, \"\".concat(prefixCls, \"-background-ghost\"), ghost && !isUnborderedButtonType(type)), _defineProperty(_classNames, \"\".concat(prefixCls, \"-loading\"), innerLoading), _defineProperty(_classNames, \"\".concat(prefixCls, \"-two-chinese-chars\"), hasTwoCNChar && autoInsertSpace), _defineProperty(_classNames, \"\".concat(prefixCls, \"-block\"), block), _defineProperty(_classNames, \"\".concat(prefixCls, \"-dangerous\"), !!danger), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _classNames), className);\n  var iconNode = icon && !innerLoading ? icon : /*#__PURE__*/React.createElement(LoadingIcon, {\n    existIcon: !!icon,\n    prefixCls: prefixCls,\n    loading: !!innerLoading\n  });\n  var kids = children || children === 0 ? spaceChildren(children, isNeedInserted() && autoInsertSpace) : null;\n  var linkButtonRestProps = omit(rest, ['navigate']);\n\n  if (linkButtonRestProps.href !== undefined) {\n    return /*#__PURE__*/React.createElement(\"a\", _extends({}, linkButtonRestProps, {\n      className: classes,\n      onClick: handleClick,\n      ref: buttonRef\n    }), iconNode, kids);\n  }\n\n  var buttonNode = /*#__PURE__*/React.createElement(\"button\", _extends({}, rest, {\n    type: htmlType,\n    className: classes,\n    onClick: handleClick,\n    ref: buttonRef\n  }), iconNode, kids);\n\n  if (isUnborderedButtonType(type)) {\n    return buttonNode;\n  }\n\n  return /*#__PURE__*/React.createElement(Wave, null, buttonNode);\n};\n\nvar Button = /*#__PURE__*/React.forwardRef(InternalButton);\nButton.displayName = 'Button';\nButton.Group = Group;\nButton.__ANT_BUTTON = true;\nexport default Button;"]},"metadata":{},"sourceType":"module"}