1 line
7.5 KiB
JSON
1 line
7.5 KiB
JSON
|
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport { useEvent } from 'rc-util';\n/**\n * Check if provided date is valid for the `disabledDate` & `showTime.disabledTime`.\n */\nexport default function useInvalidate(generateConfig, picker, disabledDate, showTime) {\n // Check disabled date\n var isInvalidate = useEvent(function (date, info) {\n var outsideInfo = _objectSpread({\n type: picker\n }, info);\n delete outsideInfo.activeIndex;\n if (\n // Date object is invalid\n !generateConfig.isValidate(date) ||\n // Date is disabled by `disabledDate`\n disabledDate && disabledDate(date, outsideInfo)) {\n return true;\n }\n if ((picker === 'date' || picker === 'time') && showTime) {\n var _showTime$disabledTim;\n var range = info && info.activeIndex === 1 ? 'end' : 'start';\n var _ref = ((_showTime$disabledTim = showTime.disabledTime) === null || _showTime$disabledTim === void 0 ? void 0 : _showTime$disabledTim.call(showTime, date, range, {\n from: outsideInfo.from\n })) || {},\n disabledHours = _ref.disabledHours,\n disabledMinutes = _ref.disabledMinutes,\n disabledSeconds = _ref.disabledSeconds,\n disabledMilliseconds = _ref.disabledMilliseconds;\n var legacyDisabledHours = showTime.disabledHours,\n legacyDisabledMinutes = showTime.disabledMinutes,\n legacyDisabledSeconds = showTime.disabledSeconds;\n var mergedDisabledHours = disabledHours || legacyDisabledHours;\n var mergedDisabledMinutes = disabledMinutes || legacyDisabledMinutes;\n var mergedDisabledSeconds = disabledSeconds || legacyDisabledSeconds;\n var hour = generateConfig.getHour(date);\n var minute = generateConfig.getMinute(date);\n var second = generateConfig.getSecond(date);\n var millisecond = generateConfig.getMillisecond(date);\n if (mergedDisabledHours && mergedDisabledHours().includes(hour)) {\n return true;\n }\n if (mergedDisabledMinutes && mergedDisabledMinutes(hour).includes(minute)) {\n return true;\n }\n if (mergedDisabledSeconds && mergedDisabledSeconds(hour, minute).includes(second)) {\n return true;\n }\n if (disabledMilliseconds && disabledMilliseconds(hour, minute, second).includes(millisecond)) {\n return true;\n }\n }\n return false;\n });\n return isInvalidate;\n}","map":{"version":3,"names":["_objectSpread","useEvent","useInvalidate","generateConfig","picker","disabledDate","showTime","isInvalidate","date","info","outsideInfo","type","activeIndex","isValidate","_showTime$disabledTim","range","_ref","disabledTime","call","from","disabledHours","disabledMinutes","disabledSeconds","disabledMilliseconds","legacyDisabledHours","legacyDisabledMinutes","legacyDisabledSeconds","mergedDisabledHours","mergedDisabledMinutes","mergedDisabledSeconds","hour","getHour","minute","getMinute","second","getSecond","millisecond","getMillisecond","includes"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-picker/es/PickerInput/hooks/useInvalidate.js"],"sourcesContent":["import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport { useEvent } from 'rc-util';\n/**\n * Check if provided date is valid for the `disabledDate` & `showTime.disabledTime`.\n */\nexport default function useInvalidate(generateConfig, picker, disabledDate, showTime) {\n // Check disabled date\n var isInvalidate = useEvent(function (date, info) {\n var outsideInfo = _objectSpread({\n type: picker\n }, info);\n delete outsideInfo.activeIndex;\n if (\n // Date object is invalid\n !generateConfig.isValidate(date) ||\n // Date is disabled by `disabledDate`\n disabledDate && disabledDate(date, outsideInfo)) {\n return true;\n }\n if ((picker === 'date' || picker === 'time') && showTime) {\n var _showTime$disabledTim;\n var range = info && info.activeIndex === 1 ? 'end' : 'start';\n var _ref = ((_showTime$disabledT
|