cff76b357dcb007b03c42c971fc082fd.json
8.06 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport { cloneElement } from '../_util/reactNode';\nimport { ConfigContext } from '../config-provider';\nimport Avatar from './avatar';\nimport Popover from '../popover';\nimport { SizeContextProvider } from './SizeContext';\n\nvar Group = function Group(props) {\n var _React$useContext = React.useContext(ConfigContext),\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction;\n\n var customizePrefixCls = props.prefixCls,\n _props$className = props.className,\n className = _props$className === void 0 ? '' : _props$className,\n maxCount = props.maxCount,\n maxStyle = props.maxStyle,\n size = props.size;\n var prefixCls = getPrefixCls('avatar-group', customizePrefixCls);\n var cls = classNames(prefixCls, _defineProperty({}, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), className);\n var children = props.children,\n _props$maxPopoverPlac = props.maxPopoverPlacement,\n maxPopoverPlacement = _props$maxPopoverPlac === void 0 ? 'top' : _props$maxPopoverPlac;\n var childrenWithProps = toArray(children).map(function (child, index) {\n return cloneElement(child, {\n key: \"avatar-key-\".concat(index)\n });\n });\n var numOfChildren = childrenWithProps.length;\n\n if (maxCount && maxCount < numOfChildren) {\n var childrenShow = childrenWithProps.slice(0, maxCount);\n var childrenHidden = childrenWithProps.slice(maxCount, numOfChildren);\n childrenShow.push( /*#__PURE__*/React.createElement(Popover, {\n key: \"avatar-popover-key\",\n content: childrenHidden,\n trigger: \"hover\",\n placement: maxPopoverPlacement,\n overlayClassName: \"\".concat(prefixCls, \"-popover\")\n }, /*#__PURE__*/React.createElement(Avatar, {\n style: maxStyle\n }, \"+\".concat(numOfChildren - maxCount))));\n return /*#__PURE__*/React.createElement(SizeContextProvider, {\n size: size\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: cls,\n style: props.style\n }, childrenShow));\n }\n\n return /*#__PURE__*/React.createElement(SizeContextProvider, {\n size: size\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: cls,\n style: props.style\n }, childrenWithProps));\n};\n\nexport default Group;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/avatar/group.js"],"names":["_defineProperty","React","classNames","toArray","cloneElement","ConfigContext","Avatar","Popover","SizeContextProvider","Group","props","_React$useContext","useContext","getPrefixCls","direction","customizePrefixCls","prefixCls","_props$className","className","maxCount","maxStyle","size","cls","concat","children","_props$maxPopoverPlac","maxPopoverPlacement","childrenWithProps","map","child","index","key","numOfChildren","length","childrenShow","slice","childrenHidden","push","createElement","content","trigger","placement","overlayClassName","style"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,uCAA5B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,OAAP,MAAoB,6BAApB;AACA,SAASC,YAAT,QAA6B,oBAA7B;AACA,SAASC,aAAT,QAA8B,oBAA9B;AACA,OAAOC,MAAP,MAAmB,UAAnB;AACA,OAAOC,OAAP,MAAoB,YAApB;AACA,SAASC,mBAAT,QAAoC,eAApC;;AAEA,IAAIC,KAAK,GAAG,SAASA,KAAT,CAAeC,KAAf,EAAsB;AAChC,MAAIC,iBAAiB,GAAGV,KAAK,CAACW,UAAN,CAAiBP,aAAjB,CAAxB;AAAA,MACIQ,YAAY,GAAGF,iBAAiB,CAACE,YADrC;AAAA,MAEIC,SAAS,GAAGH,iBAAiB,CAACG,SAFlC;;AAIA,MAAIC,kBAAkB,GAAGL,KAAK,CAACM,SAA/B;AAAA,MACIC,gBAAgB,GAAGP,KAAK,CAACQ,SAD7B;AAAA,MAEIA,SAAS,GAAGD,gBAAgB,KAAK,KAAK,CAA1B,GAA8B,EAA9B,GAAmCA,gBAFnD;AAAA,MAGIE,QAAQ,GAAGT,KAAK,CAACS,QAHrB;AAAA,MAIIC,QAAQ,GAAGV,KAAK,CAACU,QAJrB;AAAA,MAKIC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,MAAAA,gBAAgB,EAAE,GAAGnB,MAAH,CAAUP,SAAV,EAAqB,UAArB;AALyC,KAA7B,EAM7B,aAAaf,KAAK,CAACqC,aAAN,CAAoBhC,MAApB,EAA4B;AAC1CqC,MAAAA,KAAK,EAAEvB;AADmC,KAA5B,EAEb,IAAIG,MAAJ,CAAWS,aAAa,GAAGb,QAA3B,CAFa,CANgB,CAAhC;AASA,WAAO,aAAalB,KAAK,CAACqC,aAAN,CAAoB9B,mBAApB,EAAyC;AAC3Da,MAAAA,IAAI,EAAEA;AADqD,KAAzC,EAEjB,aAAapB,KAAK,CAACqC,aAAN,CAAoB,KAApB,EAA2B;AACzCpB,MAAAA,SAAS,EAAEI,GAD8B;AAEzCqB,MAAAA,KAAK,EAAEjC,KAAK,CAACiC;AAF4B,KAA3B,EAGbT,YAHa,CAFI,CAApB;AAMD;;AAED,SAAO,aAAajC,KAAK,CAACqC,aAAN,CAAoB9B,mBAApB,EAAyC;AAC3Da,IAAAA,IAAI,EAAEA;AADqD,GAAzC,EAEjB,aAAapB,KAAK,CAACqC,aAAN,CAAoB,KAApB,EAA2B;AACzCpB,IAAAA,SAAS,EAAEI,GAD8B;AAEzCqB,IAAAA,KAAK,EAAEjC,KAAK,CAACiC;AAF4B,GAA3B,EAGbhB,iBAHa,CAFI,CAApB;AAMD,CAjDD;;AAmDA,eAAelB,KAAf","sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport { cloneElement } from '../_util/reactNode';\nimport { ConfigContext } from '../config-provider';\nimport Avatar from './avatar';\nimport Popover from '../popover';\nimport { SizeContextProvider } from './SizeContext';\n\nvar Group = function Group(props) {\n var _React$useContext = React.useContext(ConfigContext),\n getPrefixCls = _React$useContext.getPrefixCls,\n direction = _React$useContext.direction;\n\n var customizePrefixCls = props.prefixCls,\n _props$className = props.className,\n className = _props$className === void 0 ? '' : _props$className,\n maxCount = props.maxCount,\n maxStyle = props.maxStyle,\n size = props.size;\n var prefixCls = getPrefixCls('avatar-group', customizePrefixCls);\n var cls = classNames(prefixCls, _defineProperty({}, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), className);\n var children = props.children,\n _props$maxPopoverPlac = props.maxPopoverPlacement,\n maxPopoverPlacement = _props$maxPopoverPlac === void 0 ? 'top' : _props$maxPopoverPlac;\n var childrenWithProps = toArray(children).map(function (child, index) {\n return cloneElement(child, {\n key: \"avatar-key-\".concat(index)\n });\n });\n var numOfChildren = childrenWithProps.length;\n\n if (maxCount && maxCount < numOfChildren) {\n var childrenShow = childrenWithProps.slice(0, maxCount);\n var childrenHidden = childrenWithProps.slice(maxCount, numOfChildren);\n childrenShow.push( /*#__PURE__*/React.createElement(Popover, {\n key: \"avatar-popover-key\",\n content: childrenHidden,\n trigger: \"hover\",\n placement: maxPopoverPlacement,\n overlayClassName: \"\".concat(prefixCls, \"-popover\")\n }, /*#__PURE__*/React.createElement(Avatar, {\n style: maxStyle\n }, \"+\".concat(numOfChildren - maxCount))));\n return /*#__PURE__*/React.createElement(SizeContextProvider, {\n size: size\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: cls,\n style: props.style\n }, childrenShow));\n }\n\n return /*#__PURE__*/React.createElement(SizeContextProvider, {\n size: size\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: cls,\n style: props.style\n }, childrenWithProps));\n};\n\nexport default Group;"]},"metadata":{},"sourceType":"module"}