6a1868f1253441c5809b15098e9021b7.json
26.4 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/extends\";\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 { useContext, useRef, useState, useEffect } from 'react';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport BarsOutlined from '@ant-design/icons/BarsOutlined';\nimport RightOutlined from '@ant-design/icons/RightOutlined';\nimport LeftOutlined from '@ant-design/icons/LeftOutlined';\nimport { LayoutContext } from './layout';\nimport { ConfigContext } from '../config-provider';\nimport isNumeric from '../_util/isNumeric';\nvar dimensionMaxMap = {\n xs: '479.98px',\n sm: '575.98px',\n md: '767.98px',\n lg: '991.98px',\n xl: '1199.98px',\n xxl: '1599.98px'\n};\nexport var SiderContext = /*#__PURE__*/React.createContext({});\n\nvar generateId = function () {\n var i = 0;\n return function () {\n var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n i += 1;\n return \"\".concat(prefix).concat(i);\n };\n}();\n\nvar Sider = function Sider(_a) {\n var customizePrefixCls = _a.prefixCls,\n className = _a.className,\n trigger = _a.trigger,\n children = _a.children,\n _a$defaultCollapsed = _a.defaultCollapsed,\n defaultCollapsed = _a$defaultCollapsed === void 0 ? false : _a$defaultCollapsed,\n _a$theme = _a.theme,\n theme = _a$theme === void 0 ? 'dark' : _a$theme,\n _a$style = _a.style,\n style = _a$style === void 0 ? {} : _a$style,\n _a$collapsible = _a.collapsible,\n collapsible = _a$collapsible === void 0 ? false : _a$collapsible,\n _a$reverseArrow = _a.reverseArrow,\n reverseArrow = _a$reverseArrow === void 0 ? false : _a$reverseArrow,\n _a$width = _a.width,\n width = _a$width === void 0 ? 200 : _a$width,\n _a$collapsedWidth = _a.collapsedWidth,\n collapsedWidth = _a$collapsedWidth === void 0 ? 80 : _a$collapsedWidth,\n zeroWidthTriggerStyle = _a.zeroWidthTriggerStyle,\n breakpoint = _a.breakpoint,\n onCollapse = _a.onCollapse,\n onBreakpoint = _a.onBreakpoint,\n props = __rest(_a, [\"prefixCls\", \"className\", \"trigger\", \"children\", \"defaultCollapsed\", \"theme\", \"style\", \"collapsible\", \"reverseArrow\", \"width\", \"collapsedWidth\", \"zeroWidthTriggerStyle\", \"breakpoint\", \"onCollapse\", \"onBreakpoint\"]);\n\n var _useContext = useContext(LayoutContext),\n siderHook = _useContext.siderHook;\n\n var _useState = useState('collapsed' in props ? props.collapsed : defaultCollapsed),\n _useState2 = _slicedToArray(_useState, 2),\n collapsed = _useState2[0],\n setCollapsed = _useState2[1];\n\n var _useState3 = useState(false),\n _useState4 = _slicedToArray(_useState3, 2),\n below = _useState4[0],\n setBelow = _useState4[1];\n\n useEffect(function () {\n if ('collapsed' in props) {\n setCollapsed(props.collapsed);\n }\n }, [props.collapsed]);\n\n var handleSetCollapsed = function handleSetCollapsed(value, type) {\n if (!('collapsed' in props)) {\n setCollapsed(value);\n }\n\n if (onCollapse) {\n onCollapse(value, type);\n }\n }; // ========================= Responsive =========================\n\n\n var responsiveHandlerRef = useRef();\n\n responsiveHandlerRef.current = function (mql) {\n setBelow(mql.matches);\n\n if (onBreakpoint) {\n onBreakpoint(mql.matches);\n }\n\n if (collapsed !== mql.matches) {\n handleSetCollapsed(mql.matches, 'responsive');\n }\n };\n\n useEffect(function () {\n function responsiveHandler(mql) {\n return responsiveHandlerRef.current(mql);\n }\n\n var mql;\n\n if (typeof window !== 'undefined') {\n var _window = window,\n matchMedia = _window.matchMedia;\n\n if (matchMedia && breakpoint && breakpoint in dimensionMaxMap) {\n mql = matchMedia(\"(max-width: \".concat(dimensionMaxMap[breakpoint], \")\"));\n\n try {\n mql.addEventListener('change', responsiveHandler);\n } catch (error) {\n mql.addListener(responsiveHandler);\n }\n\n responsiveHandler(mql);\n }\n }\n\n return function () {\n try {\n mql === null || mql === void 0 ? void 0 : mql.removeEventListener('change', responsiveHandler);\n } catch (error) {\n mql === null || mql === void 0 ? void 0 : mql.removeListener(responsiveHandler);\n }\n };\n }, []);\n useEffect(function () {\n var uniqueId = generateId('ant-sider-');\n siderHook.addSider(uniqueId);\n return function () {\n return siderHook.removeSider(uniqueId);\n };\n }, []);\n\n var toggle = function toggle() {\n handleSetCollapsed(!collapsed, 'clickTrigger');\n };\n\n var _useContext2 = useContext(ConfigContext),\n getPrefixCls = _useContext2.getPrefixCls;\n\n var renderSider = function renderSider() {\n var _classNames;\n\n var prefixCls = getPrefixCls('layout-sider', customizePrefixCls);\n var divProps = omit(props, ['collapsed']);\n var rawWidth = collapsed ? collapsedWidth : width; // use \"px\" as fallback unit for width\n\n var siderWidth = isNumeric(rawWidth) ? \"\".concat(rawWidth, \"px\") : String(rawWidth); // special trigger when collapsedWidth == 0\n\n var zeroWidthTrigger = parseFloat(String(collapsedWidth || 0)) === 0 ? /*#__PURE__*/React.createElement(\"span\", {\n onClick: toggle,\n className: classNames(\"\".concat(prefixCls, \"-zero-width-trigger\"), \"\".concat(prefixCls, \"-zero-width-trigger-\").concat(reverseArrow ? 'right' : 'left')),\n style: zeroWidthTriggerStyle\n }, trigger || /*#__PURE__*/React.createElement(BarsOutlined, null)) : null;\n var iconObj = {\n expanded: reverseArrow ? /*#__PURE__*/React.createElement(RightOutlined, null) : /*#__PURE__*/React.createElement(LeftOutlined, null),\n collapsed: reverseArrow ? /*#__PURE__*/React.createElement(LeftOutlined, null) : /*#__PURE__*/React.createElement(RightOutlined, null)\n };\n var status = collapsed ? 'collapsed' : 'expanded';\n var defaultTrigger = iconObj[status];\n var triggerDom = trigger !== null ? zeroWidthTrigger || /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-trigger\"),\n onClick: toggle,\n style: {\n width: siderWidth\n }\n }, trigger || defaultTrigger) : null;\n\n var divStyle = _extends(_extends({}, style), {\n flex: \"0 0 \".concat(siderWidth),\n maxWidth: siderWidth,\n minWidth: siderWidth,\n width: siderWidth\n });\n\n var siderCls = classNames(prefixCls, \"\".concat(prefixCls, \"-\").concat(theme), (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-collapsed\"), !!collapsed), _defineProperty(_classNames, \"\".concat(prefixCls, \"-has-trigger\"), collapsible && trigger !== null && !zeroWidthTrigger), _defineProperty(_classNames, \"\".concat(prefixCls, \"-below\"), !!below), _defineProperty(_classNames, \"\".concat(prefixCls, \"-zero-width\"), parseFloat(siderWidth) === 0), _classNames), className);\n return /*#__PURE__*/React.createElement(\"aside\", _extends({\n className: siderCls\n }, divProps, {\n style: divStyle\n }), /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-children\")\n }, children), collapsible || below && zeroWidthTrigger ? triggerDom : null);\n };\n\n return /*#__PURE__*/React.createElement(SiderContext.Provider, {\n value: {\n siderCollapsed: collapsed,\n collapsedWidth: collapsedWidth\n }\n }, renderSider());\n};\n\nexport default Sider;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/layout/Sider.js"],"names":["_defineProperty","_extends","_slicedToArray","__rest","s","e","t","p","Object","prototype","hasOwnProperty","call","indexOf","getOwnPropertySymbols","i","length","propertyIsEnumerable","React","useContext","useRef","useState","useEffect","classNames","omit","BarsOutlined","RightOutlined","LeftOutlined","LayoutContext","ConfigContext","isNumeric","dimensionMaxMap","xs","sm","md","lg","xl","xxl","SiderContext","createContext","generateId","prefix","arguments","undefined","concat","Sider","_a","customizePrefixCls","prefixCls","className","trigger","children","_a$defaultCollapsed","defaultCollapsed","_a$theme","theme","_a$style","style","_a$collapsible","collapsible","_a$reverseArrow","reverseArrow","_a$width","width","_a$collapsedWidth","collapsedWidth","zeroWidthTriggerStyle","breakpoint","onCollapse","onBreakpoint","props","_useContext","siderHook","_useState","collapsed","_useState2","setCollapsed","_useState3","_useState4","below","setBelow","handleSetCollapsed","value","type","responsiveHandlerRef","current","mql","matches","responsiveHandler","window","_window","matchMedia","addEventListener","error","addListener","removeEventListener","removeListener","uniqueId","addSider","removeSider","toggle","_useContext2","getPrefixCls","renderSider","_classNames","divProps","rawWidth","siderWidth","String","zeroWidthTrigger","parseFloat","createElement","onClick","iconObj","expanded","status","defaultTrigger","triggerDom","divStyle","flex","maxWidth","minWidth","siderCls","Provider","siderCollapsed"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,uCAA5B;AACA,OAAOC,QAAP,MAAqB,gCAArB;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,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C,CAAC2D,gBAAxF,CAAhH,EAA2N5G,eAAe,CAACuG,WAAD,EAAc,GAAG5D,MAAH,CAAUI,SAAV,EAAqB,QAArB,CAAd,EAA8C,CAAC,CAAC+B,KAAhD,CAA1O,EAAkS9E,eAAe,CAACuG,WAAD,EAAc,GAAG5D,MAAH,CAAUI,SAAV,EAAqB,aAArB,CAAd,EAAmD8D,UAAU,CAACH,UAAD,CAAV,KAA2B,CAA9E,CAAjT,EAAmYH,WAAzb,GAAucvD,SAAvc,CAAzB;AACA,WAAO,aAAa/B,KAAK,CAAC6F,aAAN,CAAoB,OAApB,EAA6B7G,QAAQ,CAAC;AACxD+C,MAAAA,SAAS,EAAEyE;AAD6C,KAAD,EAEtDjB,QAFsD,EAE5C;AACXhD,MAAAA,KAAK,EAAE6D;AADI,KAF4C,CAArC,EAIhB,aAAapG,KAAK,CAAC6F,aAAN,CAAoB,KAApB,EAA2B;AAC1C9D,MAAAA,SAAS,EAAE,GAAGL,MAAH,CAAUI,SAAV,EAAqB,WAArB;AAD+B,KAA3B,EAEdG,QAFc,CAJG,EAMNQ,WAAW,IAAIoB,KAAK,IAAI8B,gBAAxB,GAA2CQ,UAA3C,GAAwD,IANlD,CAApB;AAOD,GA3CD;;AA6CA,SAAO,aAAanG,KAAK,CAAC6F,aAAN,CAAoBzE,YAAY,CAACqF,QAAjC,EAA2C;AAC7DzC,IAAAA,KAAK,EAAE;AACL0C,MAAAA,cAAc,EAAElD,SADX;AAELT,MAAAA,cAAc,EAAEA;AAFX;AADsD,GAA3C,EAKjBsC,WAAW,EALM,CAApB;AAMD,CAvKD;;AAyKA,eAAe1D,KAAf","sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _extends from \"@babel/runtime/helpers/extends\";\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 { useContext, useRef, useState, useEffect } from 'react';\nimport classNames from 'classnames';\nimport omit from 'omit.js';\nimport BarsOutlined from '@ant-design/icons/BarsOutlined';\nimport RightOutlined from '@ant-design/icons/RightOutlined';\nimport LeftOutlined from '@ant-design/icons/LeftOutlined';\nimport { LayoutContext } from './layout';\nimport { ConfigContext } from '../config-provider';\nimport isNumeric from '../_util/isNumeric';\nvar dimensionMaxMap = {\n xs: '479.98px',\n sm: '575.98px',\n md: '767.98px',\n lg: '991.98px',\n xl: '1199.98px',\n xxl: '1599.98px'\n};\nexport var SiderContext = /*#__PURE__*/React.createContext({});\n\nvar generateId = function () {\n var i = 0;\n return function () {\n var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n i += 1;\n return \"\".concat(prefix).concat(i);\n };\n}();\n\nvar Sider = function Sider(_a) {\n var customizePrefixCls = _a.prefixCls,\n className = _a.className,\n trigger = _a.trigger,\n children = _a.children,\n _a$defaultCollapsed = _a.defaultCollapsed,\n defaultCollapsed = _a$defaultCollapsed === void 0 ? false : _a$defaultCollapsed,\n _a$theme = _a.theme,\n theme = _a$theme === void 0 ? 'dark' : _a$theme,\n _a$style = _a.style,\n style = _a$style === void 0 ? {} : _a$style,\n _a$collapsible = _a.collapsible,\n collapsible = _a$collapsible === void 0 ? false : _a$collapsible,\n _a$reverseArrow = _a.reverseArrow,\n reverseArrow = _a$reverseArrow === void 0 ? false : _a$reverseArrow,\n _a$width = _a.width,\n width = _a$width === void 0 ? 200 : _a$width,\n _a$collapsedWidth = _a.collapsedWidth,\n collapsedWidth = _a$collapsedWidth === void 0 ? 80 : _a$collapsedWidth,\n zeroWidthTriggerStyle = _a.zeroWidthTriggerStyle,\n breakpoint = _a.breakpoint,\n onCollapse = _a.onCollapse,\n onBreakpoint = _a.onBreakpoint,\n props = __rest(_a, [\"prefixCls\", \"className\", \"trigger\", \"children\", \"defaultCollapsed\", \"theme\", \"style\", \"collapsible\", \"reverseArrow\", \"width\", \"collapsedWidth\", \"zeroWidthTriggerStyle\", \"breakpoint\", \"onCollapse\", \"onBreakpoint\"]);\n\n var _useContext = useContext(LayoutContext),\n siderHook = _useContext.siderHook;\n\n var _useState = useState('collapsed' in props ? props.collapsed : defaultCollapsed),\n _useState2 = _slicedToArray(_useState, 2),\n collapsed = _useState2[0],\n setCollapsed = _useState2[1];\n\n var _useState3 = useState(false),\n _useState4 = _slicedToArray(_useState3, 2),\n below = _useState4[0],\n setBelow = _useState4[1];\n\n useEffect(function () {\n if ('collapsed' in props) {\n setCollapsed(props.collapsed);\n }\n }, [props.collapsed]);\n\n var handleSetCollapsed = function handleSetCollapsed(value, type) {\n if (!('collapsed' in props)) {\n setCollapsed(value);\n }\n\n if (onCollapse) {\n onCollapse(value, type);\n }\n }; // ========================= Responsive =========================\n\n\n var responsiveHandlerRef = useRef();\n\n responsiveHandlerRef.current = function (mql) {\n setBelow(mql.matches);\n\n if (onBreakpoint) {\n onBreakpoint(mql.matches);\n }\n\n if (collapsed !== mql.matches) {\n handleSetCollapsed(mql.matches, 'responsive');\n }\n };\n\n useEffect(function () {\n function responsiveHandler(mql) {\n return responsiveHandlerRef.current(mql);\n }\n\n var mql;\n\n if (typeof window !== 'undefined') {\n var _window = window,\n matchMedia = _window.matchMedia;\n\n if (matchMedia && breakpoint && breakpoint in dimensionMaxMap) {\n mql = matchMedia(\"(max-width: \".concat(dimensionMaxMap[breakpoint], \")\"));\n\n try {\n mql.addEventListener('change', responsiveHandler);\n } catch (error) {\n mql.addListener(responsiveHandler);\n }\n\n responsiveHandler(mql);\n }\n }\n\n return function () {\n try {\n mql === null || mql === void 0 ? void 0 : mql.removeEventListener('change', responsiveHandler);\n } catch (error) {\n mql === null || mql === void 0 ? void 0 : mql.removeListener(responsiveHandler);\n }\n };\n }, []);\n useEffect(function () {\n var uniqueId = generateId('ant-sider-');\n siderHook.addSider(uniqueId);\n return function () {\n return siderHook.removeSider(uniqueId);\n };\n }, []);\n\n var toggle = function toggle() {\n handleSetCollapsed(!collapsed, 'clickTrigger');\n };\n\n var _useContext2 = useContext(ConfigContext),\n getPrefixCls = _useContext2.getPrefixCls;\n\n var renderSider = function renderSider() {\n var _classNames;\n\n var prefixCls = getPrefixCls('layout-sider', customizePrefixCls);\n var divProps = omit(props, ['collapsed']);\n var rawWidth = collapsed ? collapsedWidth : width; // use \"px\" as fallback unit for width\n\n var siderWidth = isNumeric(rawWidth) ? \"\".concat(rawWidth, \"px\") : String(rawWidth); // special trigger when collapsedWidth == 0\n\n var zeroWidthTrigger = parseFloat(String(collapsedWidth || 0)) === 0 ? /*#__PURE__*/React.createElement(\"span\", {\n onClick: toggle,\n className: classNames(\"\".concat(prefixCls, \"-zero-width-trigger\"), \"\".concat(prefixCls, \"-zero-width-trigger-\").concat(reverseArrow ? 'right' : 'left')),\n style: zeroWidthTriggerStyle\n }, trigger || /*#__PURE__*/React.createElement(BarsOutlined, null)) : null;\n var iconObj = {\n expanded: reverseArrow ? /*#__PURE__*/React.createElement(RightOutlined, null) : /*#__PURE__*/React.createElement(LeftOutlined, null),\n collapsed: reverseArrow ? /*#__PURE__*/React.createElement(LeftOutlined, null) : /*#__PURE__*/React.createElement(RightOutlined, null)\n };\n var status = collapsed ? 'collapsed' : 'expanded';\n var defaultTrigger = iconObj[status];\n var triggerDom = trigger !== null ? zeroWidthTrigger || /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-trigger\"),\n onClick: toggle,\n style: {\n width: siderWidth\n }\n }, trigger || defaultTrigger) : null;\n\n var divStyle = _extends(_extends({}, style), {\n flex: \"0 0 \".concat(siderWidth),\n maxWidth: siderWidth,\n minWidth: siderWidth,\n width: siderWidth\n });\n\n var siderCls = classNames(prefixCls, \"\".concat(prefixCls, \"-\").concat(theme), (_classNames = {}, _defineProperty(_classNames, \"\".concat(prefixCls, \"-collapsed\"), !!collapsed), _defineProperty(_classNames, \"\".concat(prefixCls, \"-has-trigger\"), collapsible && trigger !== null && !zeroWidthTrigger), _defineProperty(_classNames, \"\".concat(prefixCls, \"-below\"), !!below), _defineProperty(_classNames, \"\".concat(prefixCls, \"-zero-width\"), parseFloat(siderWidth) === 0), _classNames), className);\n return /*#__PURE__*/React.createElement(\"aside\", _extends({\n className: siderCls\n }, divProps, {\n style: divStyle\n }), /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-children\")\n }, children), collapsible || below && zeroWidthTrigger ? triggerDom : null);\n };\n\n return /*#__PURE__*/React.createElement(SiderContext.Provider, {\n value: {\n siderCollapsed: collapsed,\n collapsedWidth: collapsedWidth\n }\n }, renderSider());\n};\n\nexport default Sider;"]},"metadata":{},"sourceType":"module"}