d543c5953022092cb04ad0ef7490455c.json
23.9 KB
{"ast":null,"code":"import _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/createSuper\";\nimport * as React from 'react';\nimport { supportRef, composeRef } from \"rc-util/es/ref\";\nimport raf from './raf';\nimport { ConfigConsumer, ConfigContext } from '../config-provider';\nimport { cloneElement } from './reactNode';\nvar styleForPseudo; // Where el is the DOM element you'd like to test for visibility\n\nfunction isHidden(element) {\n if (process.env.NODE_ENV === 'test') {\n return false;\n }\n\n return !element || element.offsetParent === null;\n}\n\nfunction isNotGrey(color) {\n // eslint-disable-next-line no-useless-escape\n var match = (color || '').match(/rgba?\\((\\d*), (\\d*), (\\d*)(, [\\d.]*)?\\)/);\n\n if (match && match[1] && match[2] && match[3]) {\n return !(match[1] === match[2] && match[2] === match[3]);\n }\n\n return true;\n}\n\nvar Wave = /*#__PURE__*/function (_React$Component) {\n _inherits(Wave, _React$Component);\n\n var _super = _createSuper(Wave);\n\n function Wave() {\n var _this;\n\n _classCallCheck(this, Wave);\n\n _this = _super.apply(this, arguments);\n _this.containerRef = /*#__PURE__*/React.createRef();\n _this.animationStart = false;\n _this.destroyed = false;\n\n _this.onClick = function (node, waveColor) {\n if (!node || isHidden(node) || node.className.indexOf('-leave') >= 0) {\n return;\n }\n\n var insertExtraNode = _this.props.insertExtraNode;\n _this.extraNode = document.createElement('div');\n\n var _assertThisInitialize = _assertThisInitialized(_this),\n extraNode = _assertThisInitialize.extraNode;\n\n var getPrefixCls = _this.context.getPrefixCls;\n extraNode.className = \"\".concat(getPrefixCls(''), \"-click-animating-node\");\n\n var attributeName = _this.getAttributeName();\n\n node.setAttribute(attributeName, 'true'); // Not white or transparent or grey\n\n styleForPseudo = styleForPseudo || document.createElement('style');\n\n if (waveColor && waveColor !== '#ffffff' && waveColor !== 'rgb(255, 255, 255)' && isNotGrey(waveColor) && !/rgba\\((?:\\d*, ){3}0\\)/.test(waveColor) && // any transparent rgba color\n waveColor !== 'transparent') {\n // Add nonce if CSP exist\n if (_this.csp && _this.csp.nonce) {\n styleForPseudo.nonce = _this.csp.nonce;\n }\n\n extraNode.style.borderColor = waveColor;\n styleForPseudo.innerHTML = \"\\n [\".concat(getPrefixCls(''), \"-click-animating-without-extra-node='true']::after, .\").concat(getPrefixCls(''), \"-click-animating-node {\\n --antd-wave-shadow-color: \").concat(waveColor, \";\\n }\");\n\n if (!document.body.contains(styleForPseudo)) {\n document.body.appendChild(styleForPseudo);\n }\n }\n\n if (insertExtraNode) {\n node.appendChild(extraNode);\n }\n\n ['transition', 'animation'].forEach(function (name) {\n node.addEventListener(\"\".concat(name, \"start\"), _this.onTransitionStart);\n node.addEventListener(\"\".concat(name, \"end\"), _this.onTransitionEnd);\n });\n };\n\n _this.onTransitionStart = function (e) {\n if (_this.destroyed) {\n return;\n }\n\n var node = _this.containerRef.current;\n\n if (!e || e.target !== node || _this.animationStart) {\n return;\n }\n\n _this.resetEffect(node);\n };\n\n _this.onTransitionEnd = function (e) {\n if (!e || e.animationName !== 'fadeEffect') {\n return;\n }\n\n _this.resetEffect(e.target);\n };\n\n _this.bindAnimationEvent = function (node) {\n if (!node || !node.getAttribute || node.getAttribute('disabled') || node.className.indexOf('disabled') >= 0) {\n return;\n }\n\n var onClick = function onClick(e) {\n // Fix radio button click twice\n if (e.target.tagName === 'INPUT' || isHidden(e.target)) {\n return;\n }\n\n _this.resetEffect(node); // Get wave color from target\n\n\n var waveColor = getComputedStyle(node).getPropertyValue('border-top-color') || // Firefox Compatible\n getComputedStyle(node).getPropertyValue('border-color') || getComputedStyle(node).getPropertyValue('background-color');\n _this.clickWaveTimeoutId = window.setTimeout(function () {\n return _this.onClick(node, waveColor);\n }, 0);\n raf.cancel(_this.animationStartId);\n _this.animationStart = true; // Render to trigger transition event cost 3 frames. Let's delay 10 frames to reset this.\n\n _this.animationStartId = raf(function () {\n _this.animationStart = false;\n }, 10);\n };\n\n node.addEventListener('click', onClick, true);\n return {\n cancel: function cancel() {\n node.removeEventListener('click', onClick, true);\n }\n };\n };\n\n _this.renderWave = function (_ref) {\n var csp = _ref.csp;\n var children = _this.props.children;\n _this.csp = csp;\n if (! /*#__PURE__*/React.isValidElement(children)) return children;\n var ref = _this.containerRef;\n\n if (supportRef(children)) {\n ref = composeRef(children.ref, _this.containerRef);\n }\n\n return cloneElement(children, {\n ref: ref\n });\n };\n\n return _this;\n }\n\n _createClass(Wave, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var node = this.containerRef.current;\n\n if (!node || node.nodeType !== 1) {\n return;\n }\n\n this.instance = this.bindAnimationEvent(node);\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n if (this.instance) {\n this.instance.cancel();\n }\n\n if (this.clickWaveTimeoutId) {\n clearTimeout(this.clickWaveTimeoutId);\n }\n\n this.destroyed = true;\n }\n }, {\n key: \"getAttributeName\",\n value: function getAttributeName() {\n var getPrefixCls = this.context.getPrefixCls;\n var insertExtraNode = this.props.insertExtraNode;\n return insertExtraNode ? \"\".concat(getPrefixCls(''), \"-click-animating\") : \"\".concat(getPrefixCls(''), \"-click-animating-without-extra-node\");\n }\n }, {\n key: \"resetEffect\",\n value: function resetEffect(node) {\n var _this2 = this;\n\n if (!node || node === this.extraNode || !(node instanceof Element)) {\n return;\n }\n\n var insertExtraNode = this.props.insertExtraNode;\n var attributeName = this.getAttributeName();\n node.setAttribute(attributeName, 'false'); // edge has bug on `removeAttribute` #14466\n\n if (styleForPseudo) {\n styleForPseudo.innerHTML = '';\n }\n\n if (insertExtraNode && this.extraNode && node.contains(this.extraNode)) {\n node.removeChild(this.extraNode);\n }\n\n ['transition', 'animation'].forEach(function (name) {\n node.removeEventListener(\"\".concat(name, \"start\"), _this2.onTransitionStart);\n node.removeEventListener(\"\".concat(name, \"end\"), _this2.onTransitionEnd);\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderWave);\n }\n }]);\n\n return Wave;\n}(React.Component);\n\nexport { Wave as default };\nWave.contextType = ConfigContext;","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/antd/es/_util/wave.js"],"names":["_classCallCheck","_createClass","_assertThisInitialized","_inherits","_createSuper","React","supportRef","composeRef","raf","ConfigConsumer","ConfigContext","cloneElement","styleForPseudo","isHidden","element","process","env","NODE_ENV","offsetParent","isNotGrey","color","match","Wave","_React$Component","_super","_this","apply","arguments","containerRef","createRef","animationStart","destroyed","onClick","node","waveColor","className","indexOf","insertExtraNode","props","extraNode","document","createElement","_assertThisInitialize","getPrefixCls","context","concat","attributeName","getAttributeName","setAttribute","test","csp","nonce","style","borderColor","innerHTML","body","contains","appendChild","forEach","name","addEventListener","onTransitionStart","onTransitionEnd","e","current","target","resetEffect","animationName","bindAnimationEvent","getAttribute","tagName","getComputedStyle","getPropertyValue","clickWaveTimeoutId","window","setTimeout","cancel","animationStartId","removeEventListener","renderWave","_ref","children","isValidElement","ref","key","value","componentDidMount","nodeType","instance","componentWillUnmount","clearTimeout","_this2","Element","removeChild","render","Component","default","contextType"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,uCAA5B;AACA,OAAOC,YAAP,MAAyB,oCAAzB;AACA,OAAOC,sBAAP,MAAmC,8CAAnC;AACA,OAAOC,SAAP,MAAsB,iCAAtB;AACA,OAAOC,YAAP,MAAyB,oCAAzB;AACA,OAAO,KAAKC,KAAZ,MAAuB,OAAvB;AACA,SAASC,UAAT,EAAqBC,UAArB,QAAuC,gBAAvC;AACA,OAAOC,GAAP,MAAgB,OAAhB;AACA,SAASC,cAAT,EAAyBC,aAAzB,QAA8C,oBAA9C;AACA,SAASC,YAAT,QAA6B,aAA7B;AACA,IAAIC,cAAJ,C,CAAoB;;AAEpB,SAASC,QAAT,CAAkBC,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AAE3C,UAAIlC,cAAJ,EAAoB;AAClBA,QAAAA,cAAc,CAAC0C,SAAf,GAA2B,EAA3B;AACD;;AAED,UAAIjB,eAAe,IAAI,KAAKE,SAAxB,IAAqCN,IAAI,CAACuB,QAAL,CAAc,KAAKjB,SAAnB,CAAzC,EAAwE;AACtEN,QAAAA,IAAI,CAAC4D,WAAL,CAAiB,KAAKtD,SAAtB;AACD;;AAED,OAAC,YAAD,EAAe,WAAf,EAA4BmB,OAA5B,CAAoC,UAAUC,IAAV,EAAgB;AAClD1B,QAAAA,IAAI,CAAC6C,mBAAL,CAAyB,GAAGjC,MAAH,CAAUc,IAAV,EAAgB,OAAhB,CAAzB,EAAmDgC,MAAM,CAAC9B,iBAA1D;AACA5B,QAAAA,IAAI,CAAC6C,mBAAL,CAAyB,GAAGjC,MAAH,CAAUc,IAAV,EAAgB,KAAhB,CAAzB,EAAiDgC,MAAM,CAAC7B,eAAxD;AACD,OAHD;AAID;AAzBA,GA/BgB,EAyDhB;AACDsB,IAAAA,GAAG,EAAE,QADJ;AAEDC,IAAAA,KAAK,EAAE,SAASS,MAAT,GAAkB;AACvB,aAAO,aAAazF,KAAK,CAACoC,aAAN,CAAoBhC,cAApB,EAAoC,IAApC,EAA0C,KAAKsE,UAA/C,CAApB;AACD;AAJA,GAzDgB,CAAP,CAAZ;;AAgEA,SAAOzD,IAAP;AACD,CAzMuB,CAyMtBjB,KAAK,CAAC0F,SAzMgB,CAAxB;;AA2MA,SAASzE,IAAI,IAAI0E,OAAjB;AACA1E,IAAI,CAAC2E,WAAL,GAAmBvF,aAAnB","sourcesContent":["import _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/createSuper\";\nimport * as React from 'react';\nimport { supportRef, composeRef } from \"rc-util/es/ref\";\nimport raf from './raf';\nimport { ConfigConsumer, ConfigContext } from '../config-provider';\nimport { cloneElement } from './reactNode';\nvar styleForPseudo; // Where el is the DOM element you'd like to test for visibility\n\nfunction isHidden(element) {\n if (process.env.NODE_ENV === 'test') {\n return false;\n }\n\n return !element || element.offsetParent === null;\n}\n\nfunction isNotGrey(color) {\n // eslint-disable-next-line no-useless-escape\n var match = (color || '').match(/rgba?\\((\\d*), (\\d*), (\\d*)(, [\\d.]*)?\\)/);\n\n if (match && match[1] && match[2] && match[3]) {\n return !(match[1] === match[2] && match[2] === match[3]);\n }\n\n return true;\n}\n\nvar Wave = /*#__PURE__*/function (_React$Component) {\n _inherits(Wave, _React$Component);\n\n var _super = _createSuper(Wave);\n\n function Wave() {\n var _this;\n\n _classCallCheck(this, Wave);\n\n _this = _super.apply(this, arguments);\n _this.containerRef = /*#__PURE__*/React.createRef();\n _this.animationStart = false;\n _this.destroyed = false;\n\n _this.onClick = function (node, waveColor) {\n if (!node || isHidden(node) || node.className.indexOf('-leave') >= 0) {\n return;\n }\n\n var insertExtraNode = _this.props.insertExtraNode;\n _this.extraNode = document.createElement('div');\n\n var _assertThisInitialize = _assertThisInitialized(_this),\n extraNode = _assertThisInitialize.extraNode;\n\n var getPrefixCls = _this.context.getPrefixCls;\n extraNode.className = \"\".concat(getPrefixCls(''), \"-click-animating-node\");\n\n var attributeName = _this.getAttributeName();\n\n node.setAttribute(attributeName, 'true'); // Not white or transparent or grey\n\n styleForPseudo = styleForPseudo || document.createElement('style');\n\n if (waveColor && waveColor !== '#ffffff' && waveColor !== 'rgb(255, 255, 255)' && isNotGrey(waveColor) && !/rgba\\((?:\\d*, ){3}0\\)/.test(waveColor) && // any transparent rgba color\n waveColor !== 'transparent') {\n // Add nonce if CSP exist\n if (_this.csp && _this.csp.nonce) {\n styleForPseudo.nonce = _this.csp.nonce;\n }\n\n extraNode.style.borderColor = waveColor;\n styleForPseudo.innerHTML = \"\\n [\".concat(getPrefixCls(''), \"-click-animating-without-extra-node='true']::after, .\").concat(getPrefixCls(''), \"-click-animating-node {\\n --antd-wave-shadow-color: \").concat(waveColor, \";\\n }\");\n\n if (!document.body.contains(styleForPseudo)) {\n document.body.appendChild(styleForPseudo);\n }\n }\n\n if (insertExtraNode) {\n node.appendChild(extraNode);\n }\n\n ['transition', 'animation'].forEach(function (name) {\n node.addEventListener(\"\".concat(name, \"start\"), _this.onTransitionStart);\n node.addEventListener(\"\".concat(name, \"end\"), _this.onTransitionEnd);\n });\n };\n\n _this.onTransitionStart = function (e) {\n if (_this.destroyed) {\n return;\n }\n\n var node = _this.containerRef.current;\n\n if (!e || e.target !== node || _this.animationStart) {\n return;\n }\n\n _this.resetEffect(node);\n };\n\n _this.onTransitionEnd = function (e) {\n if (!e || e.animationName !== 'fadeEffect') {\n return;\n }\n\n _this.resetEffect(e.target);\n };\n\n _this.bindAnimationEvent = function (node) {\n if (!node || !node.getAttribute || node.getAttribute('disabled') || node.className.indexOf('disabled') >= 0) {\n return;\n }\n\n var onClick = function onClick(e) {\n // Fix radio button click twice\n if (e.target.tagName === 'INPUT' || isHidden(e.target)) {\n return;\n }\n\n _this.resetEffect(node); // Get wave color from target\n\n\n var waveColor = getComputedStyle(node).getPropertyValue('border-top-color') || // Firefox Compatible\n getComputedStyle(node).getPropertyValue('border-color') || getComputedStyle(node).getPropertyValue('background-color');\n _this.clickWaveTimeoutId = window.setTimeout(function () {\n return _this.onClick(node, waveColor);\n }, 0);\n raf.cancel(_this.animationStartId);\n _this.animationStart = true; // Render to trigger transition event cost 3 frames. Let's delay 10 frames to reset this.\n\n _this.animationStartId = raf(function () {\n _this.animationStart = false;\n }, 10);\n };\n\n node.addEventListener('click', onClick, true);\n return {\n cancel: function cancel() {\n node.removeEventListener('click', onClick, true);\n }\n };\n };\n\n _this.renderWave = function (_ref) {\n var csp = _ref.csp;\n var children = _this.props.children;\n _this.csp = csp;\n if (! /*#__PURE__*/React.isValidElement(children)) return children;\n var ref = _this.containerRef;\n\n if (supportRef(children)) {\n ref = composeRef(children.ref, _this.containerRef);\n }\n\n return cloneElement(children, {\n ref: ref\n });\n };\n\n return _this;\n }\n\n _createClass(Wave, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n var node = this.containerRef.current;\n\n if (!node || node.nodeType !== 1) {\n return;\n }\n\n this.instance = this.bindAnimationEvent(node);\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n if (this.instance) {\n this.instance.cancel();\n }\n\n if (this.clickWaveTimeoutId) {\n clearTimeout(this.clickWaveTimeoutId);\n }\n\n this.destroyed = true;\n }\n }, {\n key: \"getAttributeName\",\n value: function getAttributeName() {\n var getPrefixCls = this.context.getPrefixCls;\n var insertExtraNode = this.props.insertExtraNode;\n return insertExtraNode ? \"\".concat(getPrefixCls(''), \"-click-animating\") : \"\".concat(getPrefixCls(''), \"-click-animating-without-extra-node\");\n }\n }, {\n key: \"resetEffect\",\n value: function resetEffect(node) {\n var _this2 = this;\n\n if (!node || node === this.extraNode || !(node instanceof Element)) {\n return;\n }\n\n var insertExtraNode = this.props.insertExtraNode;\n var attributeName = this.getAttributeName();\n node.setAttribute(attributeName, 'false'); // edge has bug on `removeAttribute` #14466\n\n if (styleForPseudo) {\n styleForPseudo.innerHTML = '';\n }\n\n if (insertExtraNode && this.extraNode && node.contains(this.extraNode)) {\n node.removeChild(this.extraNode);\n }\n\n ['transition', 'animation'].forEach(function (name) {\n node.removeEventListener(\"\".concat(name, \"start\"), _this2.onTransitionStart);\n node.removeEventListener(\"\".concat(name, \"end\"), _this2.onTransitionEnd);\n });\n }\n }, {\n key: \"render\",\n value: function render() {\n return /*#__PURE__*/React.createElement(ConfigConsumer, null, this.renderWave);\n }\n }]);\n\n return Wave;\n}(React.Component);\n\nexport { Wave as default };\nWave.contextType = ConfigContext;"]},"metadata":{},"sourceType":"module"}