PromoCursed/node_modules/.cache/babel-loader/104b9bb77a4f400cf6f87bcf55b9b4d148edb4a5f4b6e2e442644b25272c5910.json

1 line
18 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import classNames from 'classnames';\nimport * as React from 'react';\nimport { isSameOrAfter } from \"../utils/dateUtil\";\nimport { PickerHackContext, usePanelContext } from \"./context\";\nvar HIDDEN_STYLE = {\n visibility: 'hidden'\n};\nfunction PanelHeader(props) {\n var offset = props.offset,\n superOffset = props.superOffset,\n onChange = props.onChange,\n getStart = props.getStart,\n getEnd = props.getEnd,\n children = props.children;\n var _usePanelContext = usePanelContext(),\n prefixCls = _usePanelContext.prefixCls,\n _usePanelContext$prev = _usePanelContext.prevIcon,\n prevIcon = _usePanelContext$prev === void 0 ? \"\\u2039\" : _usePanelContext$prev,\n _usePanelContext$next = _usePanelContext.nextIcon,\n nextIcon = _usePanelContext$next === void 0 ? \"\\u203A\" : _usePanelContext$next,\n _usePanelContext$supe = _usePanelContext.superPrevIcon,\n superPrevIcon = _usePanelContext$supe === void 0 ? \"\\xAB\" : _usePanelContext$supe,\n _usePanelContext$supe2 = _usePanelContext.superNextIcon,\n superNextIcon = _usePanelContext$supe2 === void 0 ? \"\\xBB\" : _usePanelContext$supe2,\n minDate = _usePanelContext.minDate,\n maxDate = _usePanelContext.maxDate,\n generateConfig = _usePanelContext.generateConfig,\n locale = _usePanelContext.locale,\n pickerValue = _usePanelContext.pickerValue,\n type = _usePanelContext.panelType;\n var headerPrefixCls = \"\".concat(prefixCls, \"-header\");\n var _React$useContext = React.useContext(PickerHackContext),\n hidePrev = _React$useContext.hidePrev,\n hideNext = _React$useContext.hideNext,\n hideHeader = _React$useContext.hideHeader;\n\n // ======================= Limitation =======================\n var disabledOffsetPrev = React.useMemo(function () {\n if (!minDate || !offset || !getEnd) {\n return false;\n }\n var prevPanelLimitDate = getEnd(offset(-1, pickerValue));\n return !isSameOrAfter(generateConfig, locale, prevPanelLimitDate, minDate, type);\n }, [minDate, offset, pickerValue, getEnd, generateConfig, locale, type]);\n var disabledSuperOffsetPrev = React.useMemo(function () {\n if (!minDate || !superOffset || !getEnd) {\n return false;\n }\n var prevPanelLimitDate = getEnd(superOffset(-1, pickerValue));\n return !isSameOrAfter(generateConfig, locale, prevPanelLimitDate, minDate, type);\n }, [minDate, superOffset, pickerValue, getEnd, generateConfig, locale, type]);\n var disabledOffsetNext = React.useMemo(function () {\n if (!maxDate || !offset || !getStart) {\n return false;\n }\n var nextPanelLimitDate = getStart(offset(1, pickerValue));\n return !isSameOrAfter(generateConfig, locale, maxDate, nextPanelLimitDate, type);\n }, [maxDate, offset, pickerValue, getStart, generateConfig, locale, type]);\n var disabledSuperOffsetNext = React.useMemo(function () {\n if (!maxDate || !superOffset || !getStart) {\n return false;\n }\n var nextPanelLimitDate = getStart(superOffset(1, pickerValue));\n return !isSameOrAfter(generateConfig, locale, maxDate, nextPanelLimitDate, type);\n }, [maxDate, superOffset, pickerValue, getStart, generateConfig, locale, type]);\n\n // ========================= Offset =========================\n var onOffset = function onOffset(distance) {\n if (offset) {\n onChange(offset(distance, pickerValue));\n }\n };\n var onSuperOffset = function onSuperOffset(distance) {\n if (superOffset) {\n onChange(superOffset(distance, pickerValue));\n }\n };\n\n // ========================= Render =========================\n if (hideHeader) {\n return null;\n }\n var prevBtnCls = \"\".concat(headerPrefixCls, \"-prev-btn\");\n var nextBtnCls = \"\".concat(headerPrefixCls, \"-next-btn\");\n var superPrevBtnCls = \"\".concat(headerPrefixCls, \"-super-prev-btn\");\n var superNextBtnCls = \"\".concat(headerPrefixCls, \"-super-next-btn\");\n return /*#__PURE__*/React.createElement(\"div\", {\n className: headerPrefixCls\n }, superOffset && /*#__PURE__*/React.crea