39ced6d1ef15a3b210b28690c372c151.json
14.3 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/extends\";\nimport _typeof from \"@babel/runtime/helpers/typeof\";\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport Title from './Title';\nimport Paragraph from './Paragraph';\nimport { ConfigConsumer } from '../config-provider';\nimport Element from './Element';\nimport SkeletonAvatar from './Avatar';\nimport SkeletonButton from './Button';\nimport SkeletonInput from './Input';\nimport SkeletonImage from './Image';\n\nfunction getComponentProps(prop) {\n if (prop && _typeof(prop) === 'object') {\n return prop;\n }\n\n return {};\n}\n\nfunction getAvatarBasicProps(hasTitle, hasParagraph) {\n if (hasTitle && !hasParagraph) {\n // Square avatar\n return {\n size: 'large',\n shape: 'square'\n };\n }\n\n return {\n size: 'large',\n shape: 'circle'\n };\n}\n\nfunction getTitleBasicProps(hasAvatar, hasParagraph) {\n if (!hasAvatar && hasParagraph) {\n return {\n width: '38%'\n };\n }\n\n if (hasAvatar && hasParagraph) {\n return {\n width: '50%'\n };\n }\n\n return {};\n}\n\nfunction getParagraphBasicProps(hasAvatar, hasTitle) {\n var basicProps = {}; // Width\n\n if (!hasAvatar || !hasTitle) {\n basicProps.width = '61%';\n } // Rows\n\n\n if (!hasAvatar && hasTitle) {\n basicProps.rows = 3;\n } else {\n basicProps.rows = 2;\n }\n\n return basicProps;\n}\n\nvar Skeleton = function Skeleton(props) {\n var renderSkeleton = function renderSkeleton(_ref) {\n var getPrefixCls = _ref.getPrefixCls,\n direction = _ref.direction;\n var customizePrefixCls = props.prefixCls,\n loading = props.loading,\n className = props.className,\n children = props.children,\n avatar = props.avatar,\n title = props.title,\n paragraph = props.paragraph,\n active = props.active,\n round = props.round;\n var prefixCls = getPrefixCls('skeleton', customizePrefixCls);\n\n if (loading || !('loading' in props)) {\n var _classNames;\n\n var hasAvatar = !!avatar;\n var hasTitle = !!title;\n var hasParagraph = !!paragraph; // Avatar\n\n var avatarNode;\n\n if (hasAvatar) {\n var avatarProps = _extends(_extends({\n prefixCls: \"\".concat(prefixCls, \"-avatar\")\n }, getAvatarBasicProps(hasTitle, hasParagraph)), getComponentProps(avatar)); // We direct use SkeletonElement as avatar in skeleton internal.\n\n\n avatarNode = /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-header\")\n }, /*#__PURE__*/React.createElement(Element, avatarProps));\n }\n\n var contentNode;\n\n if (hasTitle || hasParagraph) {\n // Title\n var $title;\n\n if (hasTitle) {\n var titleProps = _extends(_extends({\n prefixCls: \"\".concat(prefixCls, \"-title\")\n }, getTitleBasicProps(hasAvatar, hasParagraph)), getComponentProps(title));\n\n $title = /*#__PURE__*/React.createElement(Title, titleProps);\n } // Paragraph\n\n\n var paragraphNode;\n\n if (hasParagraph) {\n var paragraphProps = _extends(_extends({\n prefixCls: \"\".concat(prefixCls, \"-paragraph\")\n }, getParagraphBasicProps(hasAvatar, hasTitle)), getComponentProps(paragraph));\n\n paragraphNode = /*#__PURE__*/React.createElement(Paragraph, paragraphProps);\n }\n\n contentNode = /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-content\")\n }, $title, paragraphNode);\n }\n\n var cls = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-with-avatar\"), hasAvatar), _defineProperty(_classNames, \"\".concat(prefixCls, \"-active\"), active), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-round\"), round), _classNames), className);\n return /*#__PURE__*/React.createElement(\"div\", {\n className: cls\n }, avatarNode, contentNode);\n }\n\n return children;\n };\n\n return /*#__PURE__*/React.createElement(ConfigConsumer, null, renderSkeleton);\n};\n\nSkeleton.defaultProps = {\n avatar: false,\n title: true,\n paragraph: true\n};\nSkeleton.Button = SkeletonButton;\nSkeleton.Avatar = SkeletonAvatar;\nSkeleton.Input = SkeletonInput;\nSkeleton.Image = SkeletonImage;\nexport default Skeleton;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/skeleton/Skeleton.js"],"names":["_defineProperty","_extends","_typeof","React","classNames","Title","Paragraph","ConfigConsumer","Element","SkeletonAvatar","SkeletonButton","SkeletonInput","SkeletonImage","getComponentProps","prop","getAvatarBasicProps","hasTitle","hasParagraph","size","shape","getTitleBasicProps","hasAvatar","width","getParagraphBasicProps","basicProps","rows","Skeleton","props","renderSkeleton","_ref","getPrefixCls","direction","customizePrefixCls","prefixCls","loading","className","children","avatar","title","paragraph","active","round","_classNames","avatarNode","avatarProps","concat","createElement","contentNode","$title","titleProps","paragraphNode","paragraphProps","cls","defaultProps","Button","Avatar","Input","Image"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,uCAA5B;AACA,OAAOC,QAAP,MAAqB,gCAArB;AACA,OAAOC,OAAP,MAAoB,+BAApB;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,OAAOC,KAAP,MAAkB,SAAlB;AACA,OAAOC,SAAP,MAAsB,aAAtB;AACA,SAASC,cAAT,QAA+B,oBAA/B;AACA,OAAOC,OAAP,MAAoB,WAApB;AACA,OAAOC,cAAP,MAA2B,UAA3B;AACA,OAAOC,cAAP,MAA2B,UAA3B;AACA,OAAOC,aAAP,MAA0B,SAA1B;AACA,OAAOC,aAAP,MAA0B,SAA1B;;AAEA,SAASC,iBAAT,CAA2BC,IAA3B,EAAiC;AAC/B,MAAIA,IAAI,IAAIZ,OAAO,CAACY,IAAD,CAAP,KAAkB,QAA9B,EAAwC;AACtC,WAAOA,IAAP;AACD;;AAED,SAAO,EAAP;AACD;;AAED,SAASC,mBAAT,CAA6BC,QAA7B,EAAuCC,YAAvC,EAAqD;AACnD,MAAID,QAAQ,IAAI,CAACC,YAAjB,EAA+B;AAC7B;AACA,WAAO;AACLC,MAAAA,IAAI,EAAE,OADD;AAEL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V,EAAqB,MAArB,CAAd,EAA4CF,SAAS,KAAK,KAA1D,CAAvL,EAAyP/B,eAAe,CAAC0C,WAAD,EAAc,GAAGG,MAAH,CAAUZ,SAAV,EAAqB,QAArB,CAAd,EAA8CQ,KAA9C,CAAxQ,EAA8TC,WAA3U,GAAyVP,SAAzV,CAApB;AACA,aAAO,aAAahC,KAAK,CAAC2C,aAAN,CAAoB,KAApB,EAA2B;AAC7CX,QAAAA,SAAS,EAAEiB;AADkC,OAA3B,EAEjBT,UAFiB,EAELI,WAFK,CAApB;AAGD;;AAED,WAAOX,QAAP;AACD,GAvED;;AAyEA,SAAO,aAAajC,KAAK,CAAC2C,aAAN,CAAoBvC,cAApB,EAAoC,IAApC,EAA0CqB,cAA1C,CAApB;AACD,CA3ED;;AA6EAF,QAAQ,CAAC2B,YAAT,GAAwB;AACtBhB,EAAAA,MAAM,EAAE,KADc;AAEtBC,EAAAA,KAAK,EAAE,IAFe;AAGtBC,EAAAA,SAAS,EAAE;AAHW,CAAxB;AAKAb,QAAQ,CAAC4B,MAAT,GAAkB5C,cAAlB;AACAgB,QAAQ,CAAC6B,MAAT,GAAkB9C,cAAlB;AACAiB,QAAQ,CAAC8B,KAAT,GAAiB7C,aAAjB;AACAe,QAAQ,CAAC+B,KAAT,GAAiB7C,aAAjB;AACA,eAAec,QAAf","sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/extends\";\nimport _typeof from \"@babel/runtime/helpers/typeof\";\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport Title from './Title';\nimport Paragraph from './Paragraph';\nimport { ConfigConsumer } from '../config-provider';\nimport Element from './Element';\nimport SkeletonAvatar from './Avatar';\nimport SkeletonButton from './Button';\nimport SkeletonInput from './Input';\nimport SkeletonImage from './Image';\n\nfunction getComponentProps(prop) {\n if (prop && _typeof(prop) === 'object') {\n return prop;\n }\n\n return {};\n}\n\nfunction getAvatarBasicProps(hasTitle, hasParagraph) {\n if (hasTitle && !hasParagraph) {\n // Square avatar\n return {\n size: 'large',\n shape: 'square'\n };\n }\n\n return {\n size: 'large',\n shape: 'circle'\n };\n}\n\nfunction getTitleBasicProps(hasAvatar, hasParagraph) {\n if (!hasAvatar && hasParagraph) {\n return {\n width: '38%'\n };\n }\n\n if (hasAvatar && hasParagraph) {\n return {\n width: '50%'\n };\n }\n\n return {};\n}\n\nfunction getParagraphBasicProps(hasAvatar, hasTitle) {\n var basicProps = {}; // Width\n\n if (!hasAvatar || !hasTitle) {\n basicProps.width = '61%';\n } // Rows\n\n\n if (!hasAvatar && hasTitle) {\n basicProps.rows = 3;\n } else {\n basicProps.rows = 2;\n }\n\n return basicProps;\n}\n\nvar Skeleton = function Skeleton(props) {\n var renderSkeleton = function renderSkeleton(_ref) {\n var getPrefixCls = _ref.getPrefixCls,\n direction = _ref.direction;\n var customizePrefixCls = props.prefixCls,\n loading = props.loading,\n className = props.className,\n children = props.children,\n avatar = props.avatar,\n title = props.title,\n paragraph = props.paragraph,\n active = props.active,\n round = props.round;\n var prefixCls = getPrefixCls('skeleton', customizePrefixCls);\n\n if (loading || !('loading' in props)) {\n var _classNames;\n\n var hasAvatar = !!avatar;\n var hasTitle = !!title;\n var hasParagraph = !!paragraph; // Avatar\n\n var avatarNode;\n\n if (hasAvatar) {\n var avatarProps = _extends(_extends({\n prefixCls: \"\".concat(prefixCls, \"-avatar\")\n }, getAvatarBasicProps(hasTitle, hasParagraph)), getComponentProps(avatar)); // We direct use SkeletonElement as avatar in skeleton internal.\n\n\n avatarNode = /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-header\")\n }, /*#__PURE__*/React.createElement(Element, avatarProps));\n }\n\n var contentNode;\n\n if (hasTitle || hasParagraph) {\n // Title\n var $title;\n\n if (hasTitle) {\n var titleProps = _extends(_extends({\n prefixCls: \"\".concat(prefixCls, \"-title\")\n }, getTitleBasicProps(hasAvatar, hasParagraph)), getComponentProps(title));\n\n $title = /*#__PURE__*/React.createElement(Title, titleProps);\n } // Paragraph\n\n\n var paragraphNode;\n\n if (hasParagraph) {\n var paragraphProps = _extends(_extends({\n prefixCls: \"\".concat(prefixCls, \"-paragraph\")\n }, getParagraphBasicProps(hasAvatar, hasTitle)), getComponentProps(paragraph));\n\n paragraphNode = /*#__PURE__*/React.createElement(Paragraph, paragraphProps);\n }\n\n contentNode = /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-content\")\n }, $title, paragraphNode);\n }\n\n var cls = classNames(prefixCls, (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-with-avatar\"), hasAvatar), _defineProperty(_classNames, \"\".concat(prefixCls, \"-active\"), active), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-round\"), round), _classNames), className);\n return /*#__PURE__*/React.createElement(\"div\", {\n className: cls\n }, avatarNode, contentNode);\n }\n\n return children;\n };\n\n return /*#__PURE__*/React.createElement(ConfigConsumer, null, renderSkeleton);\n};\n\nSkeleton.defaultProps = {\n avatar: false,\n title: true,\n paragraph: true\n};\nSkeleton.Button = SkeletonButton;\nSkeleton.Avatar = SkeletonAvatar;\nSkeleton.Input = SkeletonInput;\nSkeleton.Image = SkeletonImage;\nexport default Skeleton;"]},"metadata":{},"sourceType":"module"}