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$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}"],"mappings":"AAAA,OAAOA,aAAa,MAAM,0CAA0C;AACpE,SAASC,QAAQ,QAAQ,SAAS;AAClC;AACA;AACA;AACA,eAAe,SAASC,aAAaA,CAACC,cAAc,EAAEC,MAAM,EAAEC,YAAY,EAAEC,QAAQ,EAAE;EACpF;EACA,IAAIC,YAAY,GAAGN,QAAQ,CAAC,UAAUO,IAAI,EAAEC,IAAI,EAAE;IAChD,IAAIC,WAAW,GAAGV,aAAa,CAAC;MAC9BW,IAAI,EAAEP;IACR,CAAC,EAAEK,IAAI,CAAC;IACR,OAAOC,WAAW,CAACE,WAAW;IAC9B;IACA;IACA,CAACT,cAAc,CAACU,UAAU,CAACL,IAAI,CAAC;IAChC;IACAH,YAAY,IAAIA,YAAY,CAACG,IAAI,EAAEE,WAAW,CAAC,EAAE;MAC/C,OAAO,IAAI;IACb;IACA,IAAI,CAACN,MAAM,KAAK,MAAM,IAAIA,MAAM,KAAK,MAAM,KAAKE,QAAQ,EAAE;MACxD,IAAIQ,qBAAqB;MACzB,IAAIC,KAAK,GAAGN,IAAI,IAAIA,IAAI,CAACG,WAAW,KAAK,CAAC,GAAG,KAAK,GAAG,OAAO;MAC5D,IAAII,IAAI,GAAG,CAAC,CAACF,qBAAqB,GAAGR,QAAQ,CAACW,YAAY,MAAM,IAAI,IAAIH,qBAAqB,KAAK,KAAK,CAAC,GAAG,KAAK,CAAC,G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