1 line
5.2 KiB
JSON
1 line
5.2 KiB
JSON
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport { isSame } from \"../../utils/dateUtil\";\nimport { getFromDate } from \"../../utils/miscUtil\";\n\n/**\n * RangePicker need additional logic to handle the `disabled` case. e.g.\n * [disabled, enabled] should end date not before start date\n */\nexport default function useRangeDisabledDate(values, disabled, activeIndexList, generateConfig, locale, disabledDate) {\n var activeIndex = activeIndexList[activeIndexList.length - 1];\n var rangeDisabledDate = function rangeDisabledDate(date, info) {\n var _values = _slicedToArray(values, 2),\n start = _values[0],\n end = _values[1];\n var mergedInfo = _objectSpread(_objectSpread({}, info), {}, {\n from: getFromDate(values, activeIndexList)\n });\n\n // ============================ Disabled ============================\n // Should not select days before the start date\n if (activeIndex === 1 && disabled[0] && start &&\n // Same date isOK\n !isSame(generateConfig, locale, start, date, mergedInfo.type) &&\n // Before start date\n generateConfig.isAfter(start, date)) {\n return true;\n }\n\n // Should not select days after the end date\n if (activeIndex === 0 && disabled[1] && end &&\n // Same date isOK\n !isSame(generateConfig, locale, end, date, mergedInfo.type) &&\n // After end date\n generateConfig.isAfter(date, end)) {\n return true;\n }\n\n // ============================= Origin =============================\n return disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate(date, mergedInfo);\n };\n return rangeDisabledDate;\n}","map":{"version":3,"names":["_objectSpread","_slicedToArray","isSame","getFromDate","useRangeDisabledDate","values","disabled","activeIndexList","generateConfig","locale","disabledDate","activeIndex","length","rangeDisabledDate","date","info","_values","start","end","mergedInfo","from","type","isAfter"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-picker/es/PickerInput/hooks/useRangeDisabledDate.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport { isSame } from \"../../utils/dateUtil\";\nimport { getFromDate } from \"../../utils/miscUtil\";\n\n/**\n * RangePicker need additional logic to handle the `disabled` case. e.g.\n * [disabled, enabled] should end date not before start date\n */\nexport default function useRangeDisabledDate(values, disabled, activeIndexList, generateConfig, locale, disabledDate) {\n var activeIndex = activeIndexList[activeIndexList.length - 1];\n var rangeDisabledDate = function rangeDisabledDate(date, info) {\n var _values = _slicedToArray(values, 2),\n start = _values[0],\n end = _values[1];\n var mergedInfo = _objectSpread(_objectSpread({}, info), {}, {\n from: getFromDate(values, activeIndexList)\n });\n\n // ============================ Disabled ============================\n // Should not select days before the start date\n if (activeIndex === 1 && disabled[0] && start &&\n // Same date isOK\n !isSame(generateConfig, locale, start, date, mergedInfo.type) &&\n // Before start date\n generateConfig.isAfter(start, date)) {\n return true;\n }\n\n // Should not select days after the end date\n if (activeIndex === 0 && disabled[1] && end &&\n // Same date isOK\n !isSame(generateConfig, locale, end, date, mergedInfo.type) &&\n // After end date\n generateConfig.isAfter(date, end)) {\n return true;\n }\n\n // ============================= Origin =============================\n return disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate(date, mergedInfo);\n };\n return rangeDisabledDate;\n}"],"mappings":"AAAA,OAAOA,aAAa,MAAM,0CAA0C;AACpE,OAAOC,cAAc,MAAM,0CAA0C;AACrE,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,WAAW,QAAQ,sBAAsB;;AAElD;AACA;AACA;AACA;AACA,eAAe,SAASC,oBAAoBA,CAACC,MAAM,EAAEC,QAAQ,EAAEC,eAAe,EAAEC,cAAc,EAAEC,MAAM,EAAEC,YAAY,EAAE;EACpH,IAAIC,WAAW,GAAGJ,eAAe,CAACA,eAAe,CAACK,MAAM,GAAG,CAAC,CAAC;EAC7D,IAAIC,iBAAiB,GAAG,SAASA,iBAAiBA,CAACC,IAAI,EAAEC,IAAI,EAAE;IAC7D,IAAIC,OAAO,GAAGf,cAAc,CAACI,MAAM,EAAE,CAAC,CAAC;MACrCY,KAAK,GAAGD,OAAO,CAAC,CAAC,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