643d341097d0ad314410caa91058dbf1.json
4.39 KB
{"ast":null,"code":"import getScrollBarSize from './getScrollBarSize';\nimport setStyle from './setStyle';\n\nfunction isBodyOverflowing() {\n return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;\n}\n\nvar cacheStyle = {};\nexport default (function (close) {\n if (!isBodyOverflowing() && !close) {\n return;\n } // https://github.com/ant-design/ant-design/issues/19729\n\n\n var scrollingEffectClassName = 'ant-scrolling-effect';\n var scrollingEffectClassNameReg = new RegExp(\"\".concat(scrollingEffectClassName), 'g');\n var bodyClassName = document.body.className;\n\n if (close) {\n if (!scrollingEffectClassNameReg.test(bodyClassName)) return;\n setStyle(cacheStyle);\n cacheStyle = {};\n document.body.className = bodyClassName.replace(scrollingEffectClassNameReg, '').trim();\n return;\n }\n\n var scrollBarSize = getScrollBarSize();\n\n if (scrollBarSize) {\n cacheStyle = setStyle({\n position: 'relative',\n width: \"calc(100% - \".concat(scrollBarSize, \"px)\")\n });\n\n if (!scrollingEffectClassNameReg.test(bodyClassName)) {\n var addClassName = \"\".concat(bodyClassName, \" \").concat(scrollingEffectClassName);\n document.body.className = addClassName.trim();\n }\n }\n});","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-util/es/switchScrollingEffect.js"],"names":["getScrollBarSize","setStyle","isBodyOverflowing","document","body","scrollHeight","window","innerHeight","documentElement","clientHeight","innerWidth","offsetWidth","cacheStyle","close","scrollingEffectClassName","scrollingEffectClassNameReg","RegExp","concat","bodyClassName","className","test","replace","trim","scrollBarSize","position","width","addClassName"],"mappings":"AAAA,OAAOA,gBAAP,MAA6B,oBAA7B;AACA,OAAOC,QAAP,MAAqB,YAArB;;AAEA,SAASC,iBAAT,GAA6B;AAC3B,SAAOC,QAAQ,CAACC,IAAT,CAAcC,YAAd,IAA8BC,MAAM,CAACC,WAAP,IAAsBJ,QAAQ,CAACK,eAAT,CAAyBC,YAA7E,KAA8FH,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cesContent":["import getScrollBarSize from './getScrollBarSize';\nimport setStyle from './setStyle';\n\nfunction isBodyOverflowing() {\n return document.body.scrollHeight > (window.innerHeight || document.documentElement.clientHeight) && window.innerWidth > document.body.offsetWidth;\n}\n\nvar cacheStyle = {};\nexport default (function (close) {\n if (!isBodyOverflowing() && !close) {\n return;\n } // https://github.com/ant-design/ant-design/issues/19729\n\n\n var scrollingEffectClassName = 'ant-scrolling-effect';\n var scrollingEffectClassNameReg = new RegExp(\"\".concat(scrollingEffectClassName), 'g');\n var bodyClassName = document.body.className;\n\n if (close) {\n if (!scrollingEffectClassNameReg.test(bodyClassName)) return;\n setStyle(cacheStyle);\n cacheStyle = {};\n document.body.className = bodyClassName.replace(scrollingEffectClassNameReg, '').trim();\n return;\n }\n\n var scrollBarSize = getScrollBarSize();\n\n if (scrollBarSize) {\n cacheStyle = setStyle({\n position: 'relative',\n width: \"calc(100% - \".concat(scrollBarSize, \"px)\")\n });\n\n if (!scrollingEffectClassNameReg.test(bodyClassName)) {\n var addClassName = \"\".concat(bodyClassName, \" \").concat(scrollingEffectClassName);\n document.body.className = addClassName.trim();\n }\n }\n});"]},"metadata":{},"sourceType":"module"}