31a6be5b31e64564bc6c1e94ff6e2564.json 14.1 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\";\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 classNames from 'classnames';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport { ConfigContext } from '../config-provider';\nimport Item from './Item';\nexport var SpaceContext = /*#__PURE__*/React.createContext({\n  latestIndex: 0,\n  horizontalSize: 0,\n  verticalSize: 0\n});\nvar spaceSize = {\n  small: 8,\n  middle: 16,\n  large: 24\n};\n\nfunction getNumberSize(size) {\n  return typeof size === 'string' ? spaceSize[size] : size || 0;\n}\n\nvar Space = function Space(props) {\n  var _classNames;\n\n  var _React$useContext = React.useContext(ConfigContext),\n      getPrefixCls = _React$useContext.getPrefixCls,\n      space = _React$useContext.space,\n      directionConfig = _React$useContext.direction;\n\n  var _props$size = props.size,\n      size = _props$size === void 0 ? (space === null || space === void 0 ? void 0 : space.size) || 'small' : _props$size,\n      align = props.align,\n      className = props.className,\n      children = props.children,\n      _props$direction = props.direction,\n      direction = _props$direction === void 0 ? 'horizontal' : _props$direction,\n      customizePrefixCls = props.prefixCls,\n      split = props.split,\n      style = props.style,\n      _props$wrap = props.wrap,\n      wrap = _props$wrap === void 0 ? false : _props$wrap,\n      otherProps = __rest(props, [\"size\", \"align\", \"className\", \"children\", \"direction\", \"prefixCls\", \"split\", \"style\", \"wrap\"]);\n\n  var _React$useMemo = React.useMemo(function () {\n    return (Array.isArray(size) ? size : [size, size]).map(function (item) {\n      return getNumberSize(item);\n    });\n  }, [size]),\n      _React$useMemo2 = _slicedToArray(_React$useMemo, 2),\n      horizontalSize = _React$useMemo2[0],\n      verticalSize = _React$useMemo2[1];\n\n  var childNodes = toArray(children, {\n    keepEmpty: true\n  });\n\n  if (childNodes.length === 0) {\n    return null;\n  }\n\n  var mergedAlign = align === undefined && direction === 'horizontal' ? 'center' : align;\n  var prefixCls = getPrefixCls('space', customizePrefixCls);\n  var cn = classNames(prefixCls, \"\".concat(prefixCls, \"-\").concat(direction), (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), directionConfig === 'rtl'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-align-\").concat(mergedAlign), mergedAlign), _classNames), className);\n  var itemClassName = \"\".concat(prefixCls, \"-item\");\n  var marginDirection = directionConfig === 'rtl' ? 'marginLeft' : 'marginRight'; // Calculate latest one\n\n  var latestIndex = 0;\n  var nodes = childNodes.map(function (child, i) {\n    if (child !== null && child !== undefined) {\n      latestIndex = i;\n    }\n    /* eslint-disable react/no-array-index-key */\n\n\n    return /*#__PURE__*/React.createElement(Item, {\n      className: itemClassName,\n      key: \"\".concat(itemClassName, \"-\").concat(i),\n      direction: direction,\n      index: i,\n      marginDirection: marginDirection,\n      split: split,\n      wrap: wrap\n    }, child);\n    /* eslint-enable */\n  });\n  return /*#__PURE__*/React.createElement(\"div\", _extends({\n    className: cn,\n    style: _extends(_extends({}, wrap && {\n      flexWrap: 'wrap',\n      marginBottom: -verticalSize\n    }), style)\n  }, otherProps), /*#__PURE__*/React.createElement(SpaceContext.Provider, {\n    value: {\n      horizontalSize: horizontalSize,\n      verticalSize: verticalSize,\n      latestIndex: latestIndex\n    }\n  }, nodes));\n};\n\nexport default Space;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/space/index.js"],"names":["_extends","_defineProperty","_slicedToArray","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","classNames","toArray","ConfigContext","Item","SpaceContext","createContext","latestIndex","horizontalSize","verticalSize","spaceSize","small","middle","large","getNumberSize","size","Space","props","_classNames","_React$useContext","useContext","getPrefixCls","space","directionConfig","direction","_props$size","align","className","children","_props$direction","customizePrefixCls","prefixCls","split","style","_props$wrap","wrap","otherProps","_React$useMemo","useMemo","Array","isArray","map","item","_React$useMemo2","childNodes","keepEmpty","mergedAlign","undefined","cn","concat","itemClassName","marginDirection","nodes","child","createElement","key","index","flexWrap","marginBottom","Provider","value"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAOC,cAAP,MAA2B,sCAA3B;;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,QAAII,MAAM,CAACC,SAAP,CAAiBC,cAAjB,CAAgCC,IAAhC,CAAqCP,CAArC,EAAwCG,CAAxC,KAA8CF,CAAC,CAACO,OAAF,CAAUL,CAAV,IAAe,CAAjE,EAAoED,CAAC,CAACC,CAAD,CAAD,GAAOH,CAAC,CAACG,CAAD,CAAR;AACrE;;AAED,MAAIH,CAAC,IAAI,IAAL,IAAa,OAAOI,MAAM,CAACK,qBAAd,KAAwC,UAAzD,EAAqE,KAAK,IAAIC,CAAC,GAAG,CAAR,EAAWP,CAAC,GAAGC,MAAM,CAACK,qBAAP,CAA6BT,CAA7B,CAApB,EAAqDU,CAAC,GAAGP,CAAC,CAACQ,MAA3D,EAAmED,CAAC,EAApE,EAAwE;AAC3I,QAAIT,CAAC,CAACO,OAAF,CAAUL,CAAC,CAACO,CAAD,CAAX,IAAkB,CAAlB,IAAuBN,MAAM,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\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/slicedToArray\";\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 classNames from 'classnames';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport { ConfigContext } from '../config-provider';\nimport Item from './Item';\nexport var SpaceContext = /*#__PURE__*/React.createContext({\n  latestIndex: 0,\n  horizontalSize: 0,\n  verticalSize: 0\n});\nvar spaceSize = {\n  small: 8,\n  middle: 16,\n  large: 24\n};\n\nfunction getNumberSize(size) {\n  return typeof size === 'string' ? spaceSize[size] : size || 0;\n}\n\nvar Space = function Space(props) {\n  var _classNames;\n\n  var _React$useContext = React.useContext(ConfigContext),\n      getPrefixCls = _React$useContext.getPrefixCls,\n      space = _React$useContext.space,\n      directionConfig = _React$useContext.direction;\n\n  var _props$size = props.size,\n      size = _props$size === void 0 ? (space === null || space === void 0 ? void 0 : space.size) || 'small' : _props$size,\n      align = props.align,\n      className = props.className,\n      children = props.children,\n      _props$direction = props.direction,\n      direction = _props$direction === void 0 ? 'horizontal' : _props$direction,\n      customizePrefixCls = props.prefixCls,\n      split = props.split,\n      style = props.style,\n      _props$wrap = props.wrap,\n      wrap = _props$wrap === void 0 ? false : _props$wrap,\n      otherProps = __rest(props, [\"size\", \"align\", \"className\", \"children\", \"direction\", \"prefixCls\", \"split\", \"style\", \"wrap\"]);\n\n  var _React$useMemo = React.useMemo(function () {\n    return (Array.isArray(size) ? size : [size, size]).map(function (item) {\n      return getNumberSize(item);\n    });\n  }, [size]),\n      _React$useMemo2 = _slicedToArray(_React$useMemo, 2),\n      horizontalSize = _React$useMemo2[0],\n      verticalSize = _React$useMemo2[1];\n\n  var childNodes = toArray(children, {\n    keepEmpty: true\n  });\n\n  if (childNodes.length === 0) {\n    return null;\n  }\n\n  var mergedAlign = align === undefined && direction === 'horizontal' ? 'center' : align;\n  var prefixCls = getPrefixCls('space', customizePrefixCls);\n  var cn = classNames(prefixCls, \"\".concat(prefixCls, \"-\").concat(direction), (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), directionConfig === 'rtl'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-align-\").concat(mergedAlign), mergedAlign), _classNames), className);\n  var itemClassName = \"\".concat(prefixCls, \"-item\");\n  var marginDirection = directionConfig === 'rtl' ? 'marginLeft' : 'marginRight'; // Calculate latest one\n\n  var latestIndex = 0;\n  var nodes = childNodes.map(function (child, i) {\n    if (child !== null && child !== undefined) {\n      latestIndex = i;\n    }\n    /* eslint-disable react/no-array-index-key */\n\n\n    return /*#__PURE__*/React.createElement(Item, {\n      className: itemClassName,\n      key: \"\".concat(itemClassName, \"-\").concat(i),\n      direction: direction,\n      index: i,\n      marginDirection: marginDirection,\n      split: split,\n      wrap: wrap\n    }, child);\n    /* eslint-enable */\n  });\n  return /*#__PURE__*/React.createElement(\"div\", _extends({\n    className: cn,\n    style: _extends(_extends({}, wrap && {\n      flexWrap: 'wrap',\n      marginBottom: -verticalSize\n    }), style)\n  }, otherProps), /*#__PURE__*/React.createElement(SpaceContext.Provider, {\n    value: {\n      horizontalSize: horizontalSize,\n      verticalSize: verticalSize,\n      latestIndex: latestIndex\n    }\n  }, nodes));\n};\n\nexport default Space;"]},"metadata":{},"sourceType":"module"}