8602d918026881a74c0cb2a53b8cfe3c.json
11.7 KB
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport * as React from 'react';\nimport RcCollapse from 'rc-collapse';\nimport classNames from 'classnames';\nimport RightOutlined from '@ant-design/icons/RightOutlined';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport omit from 'omit.js';\nimport CollapsePanel from './CollapsePanel';\nimport { ConfigContext } from '../config-provider';\nimport collapseMotion from '../_util/motion';\nimport { cloneElement } from '../_util/reactNode';\n\nvar Collapse = function Collapse(props) {\n var _classNames;\n\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 _props$bordered = props.bordered,\n bordered = _props$bordered === void 0 ? true : _props$bordered,\n ghost = props.ghost;\n var prefixCls = getPrefixCls('collapse', customizePrefixCls);\n\n var getIconPosition = function getIconPosition() {\n var expandIconPosition = props.expandIconPosition;\n\n if (expandIconPosition !== undefined) {\n return expandIconPosition;\n }\n\n return direction === 'rtl' ? 'right' : 'left';\n };\n\n var renderExpandIcon = function renderExpandIcon() {\n var panelProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var expandIcon = props.expandIcon;\n var icon = expandIcon ? expandIcon(panelProps) : /*#__PURE__*/React.createElement(RightOutlined, {\n rotate: panelProps.isActive ? 90 : undefined\n });\n return cloneElement(icon, function () {\n return {\n className: classNames(icon.props.className, \"\".concat(prefixCls, \"-arrow\"))\n };\n });\n };\n\n var iconPosition = getIconPosition();\n var collapseClassName = classNames((_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-borderless\"), !bordered), _defineProperty(_classNames, \"\".concat(prefixCls, \"-icon-position-\").concat(iconPosition), true), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-ghost\"), !!ghost), _classNames), className);\n\n var openMotion = _extends(_extends({}, collapseMotion), {\n motionAppear: false,\n leavedClassName: \"\".concat(prefixCls, \"-content-hidden\")\n });\n\n var getItems = function getItems() {\n var children = props.children;\n return toArray(children).map(function (child, index) {\n var _a;\n\n if ((_a = child.props) === null || _a === void 0 ? void 0 : _a.disabled) {\n var key = child.key || String(index);\n var _child$props = child.props,\n disabled = _child$props.disabled,\n collapsible = _child$props.collapsible;\n\n var childProps = _extends(_extends({}, omit(child.props, 'disabled')), {\n key: key,\n collapsible: collapsible !== null && collapsible !== void 0 ? collapsible : disabled ? 'disabled' : undefined\n });\n\n return cloneElement(child, childProps);\n }\n\n return child;\n });\n };\n\n return /*#__PURE__*/React.createElement(RcCollapse, _extends({\n openMotion: openMotion\n }, props, {\n bordered: bordered,\n expandIcon: renderExpandIcon,\n prefixCls: prefixCls,\n className: collapseClassName\n }), getItems());\n};\n\nCollapse.Panel = CollapsePanel;\nexport default Collapse;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/collapse/Collapse.js"],"names":["_extends","_defineProperty","React","RcCollapse","classNames","RightOutlined","toArray","omit","CollapsePanel","ConfigContext","collapseMotion","cloneElement","Collapse","props","_classNames","_React$useContext","useContext","getPrefixCls","direction","customizePrefixCls","prefixCls","_props$className","className","_props$bordered","bordered","ghost","getIconPosition","expandIconPosition","undefined","renderExpandIcon","panelProps","arguments","length","expandIcon","icon","createElement","rotate","isActive","concat","iconPosition","collapseClassName","openMotion","motionAppear","leavedClassName","getItems","children","map","child","index","_a","disabled","key","String","_child$props","collapsible","childProps","Panel"],"mappings":"AAAA,OAAOA,QAAP,MAAqB,gCAArB;AACA,OAAOC,eAAP,MAA4B,uCAA5B;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,OAAOC,UAAP,MAAuB,aAAvB;AACA,OAAOC,UAAP,MAAuB,YAAvB;AACA,O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,aAAa7C,KAAK,CAACiC,aAAN,CAAoBhC,UAApB,EAAgCH,QAAQ,CAAC;AAC3DyC,IAAAA,UAAU,EAAEA;AAD+C,GAAD,EAEzD5B,KAFyD,EAElD;AACRW,IAAAA,QAAQ,EAAEA,QADF;AAERS,IAAAA,UAAU,EAAEJ,gBAFJ;AAGRT,IAAAA,SAAS,EAAEA,SAHH;AAIRE,IAAAA,SAAS,EAAEkB;AAJH,GAFkD,CAAxC,EAOhBI,QAAQ,EAPQ,CAApB;AAQD,CA7ED;;AA+EAhC,QAAQ,CAAC4C,KAAT,GAAiBhD,aAAjB;AACA,eAAeI,QAAf","sourcesContent":["import _extends from \"@babel/runtime/helpers/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport * as React from 'react';\nimport RcCollapse from 'rc-collapse';\nimport classNames from 'classnames';\nimport RightOutlined from '@ant-design/icons/RightOutlined';\nimport toArray from \"rc-util/es/Children/toArray\";\nimport omit from 'omit.js';\nimport CollapsePanel from './CollapsePanel';\nimport { ConfigContext } from '../config-provider';\nimport collapseMotion from '../_util/motion';\nimport { cloneElement } from '../_util/reactNode';\n\nvar Collapse = function Collapse(props) {\n var _classNames;\n\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 _props$bordered = props.bordered,\n bordered = _props$bordered === void 0 ? true : _props$bordered,\n ghost = props.ghost;\n var prefixCls = getPrefixCls('collapse', customizePrefixCls);\n\n var getIconPosition = function getIconPosition() {\n var expandIconPosition = props.expandIconPosition;\n\n if (expandIconPosition !== undefined) {\n return expandIconPosition;\n }\n\n return direction === 'rtl' ? 'right' : 'left';\n };\n\n var renderExpandIcon = function renderExpandIcon() {\n var panelProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var expandIcon = props.expandIcon;\n var icon = expandIcon ? expandIcon(panelProps) : /*#__PURE__*/React.createElement(RightOutlined, {\n rotate: panelProps.isActive ? 90 : undefined\n });\n return cloneElement(icon, function () {\n return {\n className: classNames(icon.props.className, \"\".concat(prefixCls, \"-arrow\"))\n };\n });\n };\n\n var iconPosition = getIconPosition();\n var collapseClassName = classNames((_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-borderless\"), !bordered), _defineProperty(_classNames, \"\".concat(prefixCls, \"-icon-position-\").concat(iconPosition), true), _defineProperty(_classNames, \"\".concat(prefixCls, \"-rtl\"), direction === 'rtl'), _defineProperty(_classNames, \"\".concat(prefixCls, \"-ghost\"), !!ghost), _classNames), className);\n\n var openMotion = _extends(_extends({}, collapseMotion), {\n motionAppear: false,\n leavedClassName: \"\".concat(prefixCls, \"-content-hidden\")\n });\n\n var getItems = function getItems() {\n var children = props.children;\n return toArray(children).map(function (child, index) {\n var _a;\n\n if ((_a = child.props) === null || _a === void 0 ? void 0 : _a.disabled) {\n var key = child.key || String(index);\n var _child$props = child.props,\n disabled = _child$props.disabled,\n collapsible = _child$props.collapsible;\n\n var childProps = _extends(_extends({}, omit(child.props, 'disabled')), {\n key: key,\n collapsible: collapsible !== null && collapsible !== void 0 ? collapsible : disabled ? 'disabled' : undefined\n });\n\n return cloneElement(child, childProps);\n }\n\n return child;\n });\n };\n\n return /*#__PURE__*/React.createElement(RcCollapse, _extends({\n openMotion: openMotion\n }, props, {\n bordered: bordered,\n expandIcon: renderExpandIcon,\n prefixCls: prefixCls,\n className: collapseClassName\n }), getItems());\n};\n\nCollapse.Panel = CollapsePanel;\nexport default Collapse;"]},"metadata":{},"sourceType":"module"}