e9156e54e59e98eda6c2a993fffd2b4a.json
11.2 KB
{"ast":null,"code":"import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { isInRange } from '../utils/dateUtil';\nimport { getValue } from '../utils/miscUtil';\nexport default function useCellClassName(_ref) {\n var cellPrefixCls = _ref.cellPrefixCls,\n generateConfig = _ref.generateConfig,\n rangedValue = _ref.rangedValue,\n hoverRangedValue = _ref.hoverRangedValue,\n isInView = _ref.isInView,\n isSameCell = _ref.isSameCell,\n offsetCell = _ref.offsetCell,\n today = _ref.today,\n value = _ref.value;\n\n function getClassName(currentDate) {\n var _ref2;\n\n var prevDate = offsetCell(currentDate, -1);\n var nextDate = offsetCell(currentDate, 1);\n var rangeStart = getValue(rangedValue, 0);\n var rangeEnd = getValue(rangedValue, 1);\n var hoverStart = getValue(hoverRangedValue, 0);\n var hoverEnd = getValue(hoverRangedValue, 1);\n var isRangeHovered = isInRange(generateConfig, hoverStart, hoverEnd, currentDate);\n\n function isRangeStart(date) {\n return isSameCell(rangeStart, date);\n }\n\n function isRangeEnd(date) {\n return isSameCell(rangeEnd, date);\n }\n\n var isHoverStart = isSameCell(hoverStart, currentDate);\n var isHoverEnd = isSameCell(hoverEnd, currentDate);\n var isHoverEdgeStart = (isRangeHovered || isHoverEnd) && (!isInView(prevDate) || isRangeEnd(prevDate));\n var isHoverEdgeEnd = (isRangeHovered || isHoverStart) && (!isInView(nextDate) || isRangeStart(nextDate));\n return _ref2 = {}, _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-in-view\"), isInView(currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-in-range\"), isInRange(generateConfig, rangeStart, rangeEnd, currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-start\"), isRangeStart(currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-end\"), isRangeEnd(currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-start-single\"), isRangeStart(currentDate) && !rangeEnd), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-end-single\"), isRangeEnd(currentDate) && !rangeStart), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-start-near-hover\"), isRangeStart(currentDate) && (isSameCell(prevDate, hoverStart) || isInRange(generateConfig, hoverStart, hoverEnd, prevDate))), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-end-near-hover\"), isRangeEnd(currentDate) && (isSameCell(nextDate, hoverEnd) || isInRange(generateConfig, hoverStart, hoverEnd, nextDate))), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover\"), isRangeHovered), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-start\"), isHoverStart), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-end\"), isHoverEnd), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-edge-start\"), isHoverEdgeStart), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-edge-end\"), isHoverEdgeEnd), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-edge-start-near-range\"), isHoverEdgeStart && isSameCell(prevDate, rangeEnd)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-edge-end-near-range\"), isHoverEdgeEnd && isSameCell(nextDate, rangeStart)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-today\"), isSameCell(today, currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-selected\"), isSameCell(value, currentDate)), _ref2;\n }\n\n return getClassName;\n}","map":{"version":3,"sources":["C:/Users/kkwan_000/Desktop/git/2017110269/minsung/node_modules/rc-picker/es/hooks/useCellClassName.js"],"names":["_defineProperty","isInRange","getValue","useCellClassName","_ref","cellPrefixCls","generateConfig","rangedValue","hoverRangedValue","isInView","isSameCell","offsetCell","today","value","getClassName","currentDate","_ref2","prevDate","nextDate","rangeStart","rangeEnd","hoverStart","hoverEnd","isRangeHovered","isRangeStart","date","isRangeEnd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zB,CAAR,EAA2DyB,cAA3D,CAA52C,EAAw7C9B,eAAe,CAACgB,KAAD,EAAQ,GAAGe,MAAH,CAAU1B,aAAV,EAAyB,oCAAzB,CAAR,EAAwEwB,gBAAgB,IAAInB,UAAU,CAACO,QAAD,EAAWG,QAAX,CAAtG,CAAv8C,EAAokDpB,eAAe,CAACgB,KAAD,EAAQ,GAAGe,MAAH,CAAU1B,aAAV,EAAyB,kCAAzB,CAAR,EAAsEyB,cAAc,IAAIpB,UAAU,CAACQ,QAAD,EAAWC,UAAX,CAAlG,CAAnlD,EAA8sDnB,eAAe,CAACgB,KAAD,EAAQ,GAAGe,MAAH,CAAU1B,aAAV,EAAyB,QAAzB,CAAR,EAA4CK,UAAU,CAACE,KAAD,EAAQG,WAAR,CAAtD,CAA7tD,EAA0yDf,eAAe,CAACgB,KAAD,EAAQ,GAAGe,MAAH,CAAU1B,aAAV,EAAyB,WAAzB,CAAR,EAA+CK,UAAU,CAACG,KAAD,EAAQE,WAAR,CAAzD,CAAzzD,EAAy4DC,KAAh5D;AACD;;AAED,SAAOF,YAAP;AACD","sourcesContent":["import _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport { isInRange } from '../utils/dateUtil';\nimport { getValue } from '../utils/miscUtil';\nexport default function useCellClassName(_ref) {\n var cellPrefixCls = _ref.cellPrefixCls,\n generateConfig = _ref.generateConfig,\n rangedValue = _ref.rangedValue,\n hoverRangedValue = _ref.hoverRangedValue,\n isInView = _ref.isInView,\n isSameCell = _ref.isSameCell,\n offsetCell = _ref.offsetCell,\n today = _ref.today,\n value = _ref.value;\n\n function getClassName(currentDate) {\n var _ref2;\n\n var prevDate = offsetCell(currentDate, -1);\n var nextDate = offsetCell(currentDate, 1);\n var rangeStart = getValue(rangedValue, 0);\n var rangeEnd = getValue(rangedValue, 1);\n var hoverStart = getValue(hoverRangedValue, 0);\n var hoverEnd = getValue(hoverRangedValue, 1);\n var isRangeHovered = isInRange(generateConfig, hoverStart, hoverEnd, currentDate);\n\n function isRangeStart(date) {\n return isSameCell(rangeStart, date);\n }\n\n function isRangeEnd(date) {\n return isSameCell(rangeEnd, date);\n }\n\n var isHoverStart = isSameCell(hoverStart, currentDate);\n var isHoverEnd = isSameCell(hoverEnd, currentDate);\n var isHoverEdgeStart = (isRangeHovered || isHoverEnd) && (!isInView(prevDate) || isRangeEnd(prevDate));\n var isHoverEdgeEnd = (isRangeHovered || isHoverStart) && (!isInView(nextDate) || isRangeStart(nextDate));\n return _ref2 = {}, _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-in-view\"), isInView(currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-in-range\"), isInRange(generateConfig, rangeStart, rangeEnd, currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-start\"), isRangeStart(currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-end\"), isRangeEnd(currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-start-single\"), isRangeStart(currentDate) && !rangeEnd), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-end-single\"), isRangeEnd(currentDate) && !rangeStart), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-start-near-hover\"), isRangeStart(currentDate) && (isSameCell(prevDate, hoverStart) || isInRange(generateConfig, hoverStart, hoverEnd, prevDate))), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-end-near-hover\"), isRangeEnd(currentDate) && (isSameCell(nextDate, hoverEnd) || isInRange(generateConfig, hoverStart, hoverEnd, nextDate))), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover\"), isRangeHovered), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-start\"), isHoverStart), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-end\"), isHoverEnd), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-edge-start\"), isHoverEdgeStart), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-edge-end\"), isHoverEdgeEnd), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-edge-start-near-range\"), isHoverEdgeStart && isSameCell(prevDate, rangeEnd)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-range-hover-edge-end-near-range\"), isHoverEdgeEnd && isSameCell(nextDate, rangeStart)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-today\"), isSameCell(today, currentDate)), _defineProperty(_ref2, \"\".concat(cellPrefixCls, \"-selected\"), isSameCell(value, currentDate)), _ref2;\n }\n\n return getClassName;\n}"]},"metadata":{},"sourceType":"module"}