PromoCursed/node_modules/.cache/babel-loader/4e2c9ae88b5d1a1eac4e07c359247a1d8d0f09c1598cde8ad7bc7c03e7f4e454.json

1 line
22 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport classNames from 'classnames';\nimport * as React from 'react';\nimport { formatValue, getWeekStartDate, isSameDate, isSameMonth, WEEK_DAY_COUNT } from \"../../utils/dateUtil\";\nimport { PanelContext, useInfo } from \"../context\";\nimport PanelBody from \"../PanelBody\";\nimport PanelHeader from \"../PanelHeader\";\nexport default function DatePanel(props) {\n var prefixCls = props.prefixCls,\n _props$panelName = props.panelName,\n panelName = _props$panelName === void 0 ? 'date' : _props$panelName,\n locale = props.locale,\n generateConfig = props.generateConfig,\n pickerValue = props.pickerValue,\n onPickerValueChange = props.onPickerValueChange,\n onModeChange = props.onModeChange,\n _props$mode = props.mode,\n mode = _props$mode === void 0 ? 'date' : _props$mode,\n disabledDate = props.disabledDate,\n onSelect = props.onSelect,\n onHover = props.onHover,\n showWeek = props.showWeek;\n var panelPrefixCls = \"\".concat(prefixCls, \"-\").concat(panelName, \"-panel\");\n var cellPrefixCls = \"\".concat(prefixCls, \"-cell\");\n var isWeek = mode === 'week';\n\n // ========================== Base ==========================\n var _useInfo = useInfo(props, mode),\n _useInfo2 = _slicedToArray(_useInfo, 2),\n info = _useInfo2[0],\n now = _useInfo2[1];\n var weekFirstDay = generateConfig.locale.getWeekFirstDay(locale.locale);\n var monthStartDate = generateConfig.setDate(pickerValue, 1);\n var baseDate = getWeekStartDate(locale.locale, generateConfig, monthStartDate);\n var month = generateConfig.getMonth(pickerValue);\n\n // =========================== PrefixColumn ===========================\n var showPrefixColumn = showWeek === undefined ? isWeek : showWeek;\n var prefixColumn = showPrefixColumn ? function (date) {\n // >>> Additional check for disabled\n var disabled = disabledDate === null || disabledDate === void 0 ? void 0 : disabledDate(date, {\n type: 'week'\n });\n return /*#__PURE__*/React.createElement(\"td\", {\n key: \"week\",\n className: classNames(cellPrefixCls, \"\".concat(cellPrefixCls, \"-week\"), _defineProperty({}, \"\".concat(cellPrefixCls, \"-disabled\"), disabled))\n // Operation: Same as code in PanelBody\n ,\n\n onClick: function onClick() {\n if (!disabled) {\n onSelect(date);\n }\n },\n onMouseEnter: function onMouseEnter() {\n if (!disabled) {\n onHover === null || onHover === void 0 || onHover(date);\n }\n },\n onMouseLeave: function onMouseLeave() {\n if (!disabled) {\n onHover === null || onHover === void 0 || onHover(null);\n }\n }\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(cellPrefixCls, \"-inner\")\n }, generateConfig.locale.getWeek(locale.locale, date)));\n } : null;\n\n // ========================= Cells ==========================\n // >>> Header Cells\n var headerCells = [];\n var weekDaysLocale = locale.shortWeekDays || (generateConfig.locale.getShortWeekDays ? generateConfig.locale.getShortWeekDays(locale.locale) : []);\n if (prefixColumn) {\n headerCells.push( /*#__PURE__*/React.createElement(\"th\", {\n key: \"empty\",\n \"aria-label\": \"empty cell\"\n }));\n }\n for (var i = 0; i < WEEK_DAY_COUNT; i += 1) {\n headerCells.push( /*#__PURE__*/React.createElement(\"th\", {\n key: i\n }, weekDaysLocale[(i + weekFirstDay) % WEEK_DAY_COUNT]));\n }\n\n // >>> Body Cells\n var getCellDate = function getCellDate(date, offset) {\n return generateConfig.addDate(date, offset);\n };\n var getCellText = function getCellText(date) {\n return formatValue(date, {\n locale: locale,\n format: locale.cellDateFormat,\n generateConfig: generateConfig\n });\n };\n var get