PromoCursed/node_modules/.cache/babel-loader/7e7d4999723bfc65aecc7241a45de83ca4f5dba151886f46e5cca7bdb0bda4e7.json

1 line
23 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport { warning } from 'rc-util';\nimport * as React from 'react';\nimport { findValidateTime } from \"../PickerPanel/TimePanel/TimePanelBody/util\";\nimport { leftPad } from \"../utils/miscUtil\";\nfunction emptyDisabled() {\n return [];\n}\nfunction generateUnits(start, end) {\n var step = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;\n var hideDisabledOptions = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;\n var disabledUnits = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];\n var pad = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 2;\n var units = [];\n var integerStep = step >= 1 ? step | 0 : 1;\n for (var i = start; i <= end; i += integerStep) {\n var disabled = disabledUnits.includes(i);\n if (!disabled || !hideDisabledOptions) {\n units.push({\n label: leftPad(i, pad),\n value: i,\n disabled: disabled\n });\n }\n }\n return units;\n}\n\n/**\n * Parse time props to get util info\n */\nexport default function useTimeInfo(generateConfig) {\n var props = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var date = arguments.length > 2 ? arguments[2] : undefined;\n var _ref = props || {},\n use12Hours = _ref.use12Hours,\n _ref$hourStep = _ref.hourStep,\n hourStep = _ref$hourStep === void 0 ? 1 : _ref$hourStep,\n _ref$minuteStep = _ref.minuteStep,\n minuteStep = _ref$minuteStep === void 0 ? 1 : _ref$minuteStep,\n _ref$secondStep = _ref.secondStep,\n secondStep = _ref$secondStep === void 0 ? 1 : _ref$secondStep,\n _ref$millisecondStep = _ref.millisecondStep,\n millisecondStep = _ref$millisecondStep === void 0 ? 100 : _ref$millisecondStep,\n hideDisabledOptions = _ref.hideDisabledOptions,\n disabledTime = _ref.disabledTime,\n disabledHours = _ref.disabledHours,\n disabledMinutes = _ref.disabledMinutes,\n disabledSeconds = _ref.disabledSeconds;\n var mergedDate = React.useMemo(function () {\n return date || generateConfig.getNow();\n }, [date, generateConfig]);\n\n // ======================== Warnings ========================\n if (process.env.NODE_ENV !== 'production') {\n var isHourStepValid = 24 % hourStep === 0;\n var isMinuteStepValid = 60 % minuteStep === 0;\n var isSecondStepValid = 60 % secondStep === 0;\n warning(isHourStepValid, \"`hourStep` \".concat(hourStep, \" is invalid. It should be a factor of 24.\"));\n warning(isMinuteStepValid, \"`minuteStep` \".concat(minuteStep, \" is invalid. It should be a factor of 60.\"));\n warning(isSecondStepValid, \"`secondStep` \".concat(secondStep, \" is invalid. It should be a factor of 60.\"));\n }\n\n // ======================== Disabled ========================\n var getDisabledTimes = React.useCallback(function (targetDate) {\n var disabledConfig = (disabledTime === null || disabledTime === void 0 ? void 0 : disabledTime(targetDate)) || {};\n return [disabledConfig.disabledHours || disabledHours || emptyDisabled, disabledConfig.disabledMinutes || disabledMinutes || emptyDisabled, disabledConfig.disabledSeconds || disabledSeconds || emptyDisabled, disabledConfig.disabledMilliseconds || emptyDisabled];\n }, [disabledTime, disabledHours, disabledMinutes, disabledSeconds]);\n var _React$useMemo = React.useMemo(function () {\n return getDisabledTimes(mergedDate);\n }, [mergedDate, getDisabledTimes]),\n _React$useMemo2 = _slicedToArray(_React$useMemo, 4),\n mergedDisabledHours = _React$useMemo2[0],\n mergedDisabledMinutes = _React$useMemo2[1],\n mergedDisabledSeconds = _React$useMemo2[2],\n mergedDisabledMilliseconds = _React$useMemo2[3];\n\n // ========================= Column =========================\n var getAllUnits = React.useCallback(function (getDisabledHours, getDisabledMinutes, getDisabledSeconds, getDisabledMilliseconds) {\