d8902752efaa89a470517d340ad1476e.json
5.35 KB
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport { useState, useEffect, useRef } from 'react';\nimport useValueTexts from './useValueTexts';\nexport default function useHoverValue(valueText, _ref) {\n var formatList = _ref.formatList,\n generateConfig = _ref.generateConfig,\n locale = _ref.locale;\n\n var _useState = useState(null),\n _useState2 = _slicedToArray(_useState, 2),\n value = _useState2[0],\n internalSetValue = _useState2[1];\n\n var raf = useRef(null);\n\n function setValue(val) {\n var immediately = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n cancelAnimationFrame(raf.current);\n\n if (immediately) {\n internalSetValue(val);\n return;\n }\n\n raf.current = requestAnimationFrame(function () {\n internalSetValue(val);\n });\n }\n\n var _useValueTexts = useValueTexts(value, {\n formatList: formatList,\n generateConfig: generateConfig,\n locale: locale\n }),\n _useValueTexts2 = _slicedToArray(_useValueTexts, 2),\n firstText = _useValueTexts2[1];\n\n function onEnter(date) {\n setValue(date);\n }\n\n function onLeave() {\n var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n setValue(null, immediately);\n }\n\n useEffect(function () {\n onLeave(true);\n }, [valueText]);\n useEffect(function () {\n return function () {\n return cancelAnimationFrame(raf.current);\n };\n }, []);\n return [firstText, onEnter, onLeave];\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-picker/es/hooks/useHoverValue.js"],"names":["_slicedToArray","useState","useEffect","useRef","useValueTexts","useHoverValue","valueText","_ref","formatList","generateConfig","locale","_useState","_useState2","value","internalSetValue","raf","setValue","val","immediately","arguments","length","undefined","cancelAnimationFrame","current","requestAnimationFrame","_useValueTexts","_useValueTexts2","firstText","onEnter","date","onLeave"],"mappings":"AAAA,OAAOA,cAAP,MAA2B,0CAA3B;AACA,SAASC,QAAT,EAAmBC,SAAnB,EAA8BC,MAA9B,QAA4C,OAA5C;AACA,OAAOC,aAAP,MAA0B,iB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CAN/B;;AAQA,WAASE,OAAT,CAAiBC,IAAjB,EAAuB;AACrBb,IAAAA,QAAQ,CAACa,IAAD,CAAR;AACD;;AAED,WAASC,OAAT,GAAmB;AACjB,QAAIZ,WAAW,GAAGC,SAAS,CAACC,MAAV,GAAmB,CAAnB,IAAwBD,SAAS,CAAC,CAAD,CAAT,KAAiBE,SAAzC,GAAqDF,SAAS,CAAC,CAAD,CAA9D,GAAoE,KAAtF;AACAH,IAAAA,QAAQ,CAAC,IAAD,EAAOE,WAAP,CAAR;AACD;;AAEDhB,EAAAA,SAAS,CAAC,YAAY;AACpB4B,IAAAA,OAAO,CAAC,IAAD,CAAP;AACD,GAFQ,EAEN,CAACxB,SAAD,CAFM,CAAT;AAGAJ,EAAAA,SAAS,CAAC,YAAY;AACpB,WAAO,YAAY;AACjB,aAAOoB,oBAAoB,CAACP,GAAG,CAACQ,OAAL,CAA3B;AACD,KAFD;AAGD,GAJQ,EAIN,EAJM,CAAT;AAKA,SAAO,CAACI,SAAD,EAAYC,OAAZ,EAAqBE,OAArB,CAAP;AACD","sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport { useState, useEffect, useRef } from 'react';\nimport useValueTexts from './useValueTexts';\nexport default function useHoverValue(valueText, _ref) {\n var formatList = _ref.formatList,\n generateConfig = _ref.generateConfig,\n locale = _ref.locale;\n\n var _useState = useState(null),\n _useState2 = _slicedToArray(_useState, 2),\n value = _useState2[0],\n internalSetValue = _useState2[1];\n\n var raf = useRef(null);\n\n function setValue(val) {\n var immediately = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n cancelAnimationFrame(raf.current);\n\n if (immediately) {\n internalSetValue(val);\n return;\n }\n\n raf.current = requestAnimationFrame(function () {\n internalSetValue(val);\n });\n }\n\n var _useValueTexts = useValueTexts(value, {\n formatList: formatList,\n generateConfig: generateConfig,\n locale: locale\n }),\n _useValueTexts2 = _slicedToArray(_useValueTexts, 2),\n firstText = _useValueTexts2[1];\n\n function onEnter(date) {\n setValue(date);\n }\n\n function onLeave() {\n var immediately = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n setValue(null, immediately);\n }\n\n useEffect(function () {\n onLeave(true);\n }, [valueText]);\n useEffect(function () {\n return function () {\n return cancelAnimationFrame(raf.current);\n };\n }, []);\n return [firstText, onEnter, onLeave];\n}"]},"metadata":{},"sourceType":"module"}