4d3381d941efbef6be89da78635dea5e.json
15.1 KB
{"ast":null,"code":"import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport { findDOMNode } from 'react-dom';\nimport keyCode from \"rc-util/es/KeyCode\";\nexport function isEventFromHandle(e, handles) {\n try {\n return Object.keys(handles).some(function (key) {\n return e.target === findDOMNode(handles[key]);\n });\n } catch (error) {\n return false;\n }\n}\nexport function isValueOutOfRange(value, _ref) {\n var min = _ref.min,\n max = _ref.max;\n return value < min || value > max;\n}\nexport function isNotTouchEvent(e) {\n return e.touches.length > 1 || e.type.toLowerCase() === 'touchend' && e.touches.length > 0;\n}\nexport function getClosestPoint(val, _ref2) {\n var marks = _ref2.marks,\n step = _ref2.step,\n min = _ref2.min,\n max = _ref2.max;\n var points = Object.keys(marks).map(parseFloat);\n\n if (step !== null) {\n var baseNum = Math.pow(10, getPrecision(step));\n var maxSteps = Math.floor((max * baseNum - min * baseNum) / (step * baseNum));\n var steps = Math.min((val - min) / step, maxSteps);\n var closestStep = Math.round(steps) * step + min;\n points.push(closestStep);\n }\n\n var diffs = points.map(function (point) {\n return Math.abs(val - point);\n });\n return points[diffs.indexOf(Math.min.apply(Math, _toConsumableArray(diffs)))];\n}\nexport function getPrecision(step) {\n var stepString = step.toString();\n var precision = 0;\n\n if (stepString.indexOf('.') >= 0) {\n precision = stepString.length - stepString.indexOf('.') - 1;\n }\n\n return precision;\n}\nexport function getMousePosition(vertical, e) {\n return vertical ? e.clientY : e.pageX;\n}\nexport function getTouchPosition(vertical, e) {\n return vertical ? e.touches[0].clientY : e.touches[0].pageX;\n}\nexport function getHandleCenterPosition(vertical, handle) {\n var coords = handle.getBoundingClientRect();\n return vertical ? coords.top + coords.height * 0.5 : window.pageXOffset + coords.left + coords.width * 0.5;\n}\nexport function ensureValueInRange(val, _ref3) {\n var max = _ref3.max,\n min = _ref3.min;\n\n if (val <= min) {\n return min;\n }\n\n if (val >= max) {\n return max;\n }\n\n return val;\n}\nexport function ensureValuePrecision(val, props) {\n var step = props.step;\n var closestPoint = isFinite(getClosestPoint(val, props)) ? getClosestPoint(val, props) : 0; // eslint-disable-line\n\n return step === null ? closestPoint : parseFloat(closestPoint.toFixed(getPrecision(step)));\n}\nexport function pauseEvent(e) {\n e.stopPropagation();\n e.preventDefault();\n}\nexport function calculateNextValue(func, value, props) {\n var operations = {\n increase: function increase(a, b) {\n return a + b;\n },\n decrease: function decrease(a, b) {\n return a - b;\n }\n };\n var indexToGet = operations[func](Object.keys(props.marks).indexOf(JSON.stringify(value)), 1);\n var keyToGet = Object.keys(props.marks)[indexToGet];\n\n if (props.step) {\n return operations[func](value, props.step);\n }\n\n if (!!Object.keys(props.marks).length && !!props.marks[keyToGet]) {\n return props.marks[keyToGet];\n }\n\n return value;\n}\nexport function getKeyboardValueMutator(e, vertical, reverse) {\n var increase = 'increase';\n var decrease = 'decrease';\n var method = increase;\n\n switch (e.keyCode) {\n case keyCode.UP:\n method = vertical && reverse ? decrease : increase;\n break;\n\n case keyCode.RIGHT:\n method = !vertical && reverse ? decrease : increase;\n break;\n\n case keyCode.DOWN:\n method = vertical && reverse ? increase : decrease;\n break;\n\n case keyCode.LEFT:\n method = !vertical && reverse ? increase : decrease;\n break;\n\n case keyCode.END:\n return function (value, props) {\n return props.max;\n };\n\n case keyCode.HOME:\n return function (value, props) {\n return props.min;\n };\n\n case keyCode.PAGE_UP:\n return function (value, props) {\n return value + props.step * 2;\n };\n\n case keyCode.PAGE_DOWN:\n return function (value, props) {\n return value - props.step * 2;\n };\n\n default:\n return undefined;\n }\n\n return function (value, props) {\n return calculateNextValue(method, value, props);\n };\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-slider/es/utils.js"],"names":["_toConsumableArray","findDOMNode","keyCode","isEventFromHandle","e","handles","Object","keys","some","key","target","error","isValueOutOfRange","value","_ref","min","max","isNotTouchEvent","touches","length","type","toLowerCase","getClosestPoint","val","_ref2","marks","step","points","map","parseFloat","baseNum","Math","pow","getPrecision","maxSteps","floor","steps","closestStep","round","push","diffs","point","abs","indexOf","apply","stepString","toString","precision","getMousePosition","vertical","clientY","pageX","getTouchPosition","getHandleCenterPosition","handle","coords","getBoundingClientRect","top","height","window","pageXOffset","left","width","ensureValueInRange","_ref3","ensureValuePrecision","props","closestPoint","isFinite","toFixed","pauseEvent","stopPropagation","preventDefault","calculateNextValue","func","operations","increase","a","b","decrease","indexToGet","JSON","stringify","keyToGet","getKeyboardValueMutator","reverse","method","UP","RIGHT","DOWN","LEFT","END","HOME","PAGE_UP","PAGE_DOWN","undefined"],"mappings":"AAAA,OAAOA,kBAAP,MAA+B,8CAA/B;AACA,SAASC,WAAT,QAA4B,WAA5B;AACA,OAAOC,OAAP,MAAoB,oBAApB;AACA,OAAO,SAASC,iBAAT,CAA2BC,CAA3B,EAA8BC,OAA9B,EAAuC;AAC5C,MAAI;AACF,WAAOC,MAAM,CAACC,IAAP,CAAYF,OAAZ,EAAqBG,IAArB,CAA0B,UAAUC,GAAV,EAAe;AAC9C,aAAOL,CAAC,CAACM,MAAF,KAAaT,WAAW,CAACI,OAAO,CAACI,GAAD,CAAR,CAA/B;AACD,KAFM,CAAP;AAGD,GAJD,CAIE,OAAOE,KAAP,EAAc;AACd,WAAO,KAAP;AACD;AACF;AACD,OAAO,SAASC,iBAAT,CAA2BC,KAA3B,EAAkCC,IAAlC,EAAwC;AAC7C,MAAIC,GAAG,GAAGD,IAAI,CAACC,GAAf;AAAA,MACIC,GAAG,GAAGF,IAAI,CAACE,GADf;AAEA,SAAOH,KAAK,GAAGE,GAAR,IAAeF,KAAK,GAAGG,GAA9B;AACD;AACD,OAAO,SAASC,eAAT,CAAyBb,CAAzB,EAA4B;AACjC,SAAOA,CAAC,CAACc,OAAF,CAAUC,MAAV,GAAmB,CAAnB,IAAwBf,CAAC,CAACgB,IAAF,CAAOC,WAAP,OAAyB,UAAzB,IAAuCjB,CAAC,CAACc,OAAF,CAAUC,MAAV,GAAmB,CAAzF;AACD;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Ab;AACE,aAAO,UAAU/E,KAAV,EAAiBqD,KAAjB,EAAwB;AAC7B,eAAOA,KAAK,CAACnD,GAAb;AACD,OAFD;;AAIF,SAAKb,OAAO,CAAC2F,OAAb;AACE,aAAO,UAAUhF,KAAV,EAAiBqD,KAAjB,EAAwB;AAC7B,eAAOrD,KAAK,GAAGqD,KAAK,CAACxC,IAAN,GAAa,CAA5B;AACD,OAFD;;AAIF,SAAKxB,OAAO,CAAC4F,SAAb;AACE,aAAO,UAAUjF,KAAV,EAAiBqD,KAAjB,EAAwB;AAC7B,eAAOrD,KAAK,GAAGqD,KAAK,CAACxC,IAAN,GAAa,CAA5B;AACD,OAFD;;AAIF;AACE,aAAOqE,SAAP;AAtCJ;;AAyCA,SAAO,UAAUlF,KAAV,EAAiBqD,KAAjB,EAAwB;AAC7B,WAAOO,kBAAkB,CAACa,MAAD,EAASzE,KAAT,EAAgBqD,KAAhB,CAAzB;AACD,GAFD;AAGD","sourcesContent":["import _toConsumableArray from \"@babel/runtime/helpers/esm/toConsumableArray\";\nimport { findDOMNode } from 'react-dom';\nimport keyCode from \"rc-util/es/KeyCode\";\nexport function isEventFromHandle(e, handles) {\n try {\n return Object.keys(handles).some(function (key) {\n return e.target === findDOMNode(handles[key]);\n });\n } catch (error) {\n return false;\n }\n}\nexport function isValueOutOfRange(value, _ref) {\n var min = _ref.min,\n max = _ref.max;\n return value < min || value > max;\n}\nexport function isNotTouchEvent(e) {\n return e.touches.length > 1 || e.type.toLowerCase() === 'touchend' && e.touches.length > 0;\n}\nexport function getClosestPoint(val, _ref2) {\n var marks = _ref2.marks,\n step = _ref2.step,\n min = _ref2.min,\n max = _ref2.max;\n var points = Object.keys(marks).map(parseFloat);\n\n if (step !== null) {\n var baseNum = Math.pow(10, getPrecision(step));\n var maxSteps = Math.floor((max * baseNum - min * baseNum) / (step * baseNum));\n var steps = Math.min((val - min) / step, maxSteps);\n var closestStep = Math.round(steps) * step + min;\n points.push(closestStep);\n }\n\n var diffs = points.map(function (point) {\n return Math.abs(val - point);\n });\n return points[diffs.indexOf(Math.min.apply(Math, _toConsumableArray(diffs)))];\n}\nexport function getPrecision(step) {\n var stepString = step.toString();\n var precision = 0;\n\n if (stepString.indexOf('.') >= 0) {\n precision = stepString.length - stepString.indexOf('.') - 1;\n }\n\n return precision;\n}\nexport function getMousePosition(vertical, e) {\n return vertical ? e.clientY : e.pageX;\n}\nexport function getTouchPosition(vertical, e) {\n return vertical ? e.touches[0].clientY : e.touches[0].pageX;\n}\nexport function getHandleCenterPosition(vertical, handle) {\n var coords = handle.getBoundingClientRect();\n return vertical ? coords.top + coords.height * 0.5 : window.pageXOffset + coords.left + coords.width * 0.5;\n}\nexport function ensureValueInRange(val, _ref3) {\n var max = _ref3.max,\n min = _ref3.min;\n\n if (val <= min) {\n return min;\n }\n\n if (val >= max) {\n return max;\n }\n\n return val;\n}\nexport function ensureValuePrecision(val, props) {\n var step = props.step;\n var closestPoint = isFinite(getClosestPoint(val, props)) ? getClosestPoint(val, props) : 0; // eslint-disable-line\n\n return step === null ? closestPoint : parseFloat(closestPoint.toFixed(getPrecision(step)));\n}\nexport function pauseEvent(e) {\n e.stopPropagation();\n e.preventDefault();\n}\nexport function calculateNextValue(func, value, props) {\n var operations = {\n increase: function increase(a, b) {\n return a + b;\n },\n decrease: function decrease(a, b) {\n return a - b;\n }\n };\n var indexToGet = operations[func](Object.keys(props.marks).indexOf(JSON.stringify(value)), 1);\n var keyToGet = Object.keys(props.marks)[indexToGet];\n\n if (props.step) {\n return operations[func](value, props.step);\n }\n\n if (!!Object.keys(props.marks).length && !!props.marks[keyToGet]) {\n return props.marks[keyToGet];\n }\n\n return value;\n}\nexport function getKeyboardValueMutator(e, vertical, reverse) {\n var increase = 'increase';\n var decrease = 'decrease';\n var method = increase;\n\n switch (e.keyCode) {\n case keyCode.UP:\n method = vertical && reverse ? decrease : increase;\n break;\n\n case keyCode.RIGHT:\n method = !vertical && reverse ? decrease : increase;\n break;\n\n case keyCode.DOWN:\n method = vertical && reverse ? increase : decrease;\n break;\n\n case keyCode.LEFT:\n method = !vertical && reverse ? increase : decrease;\n break;\n\n case keyCode.END:\n return function (value, props) {\n return props.max;\n };\n\n case keyCode.HOME:\n return function (value, props) {\n return props.min;\n };\n\n case keyCode.PAGE_UP:\n return function (value, props) {\n return value + props.step * 2;\n };\n\n case keyCode.PAGE_DOWN:\n return function (value, props) {\n return value - props.step * 2;\n };\n\n default:\n return undefined;\n }\n\n return function (value, props) {\n return calculateNextValue(method, value, props);\n };\n}"]},"metadata":{},"sourceType":"module"}