PromoCursed/node_modules/.cache/babel-loader/32f64083eed46b32846558b0b8af314f487e609f143021a3612f1edcd6b117ef.json

1 line
12 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 * as React from 'react';\nimport { formatValue } from \"../../utils/dateUtil\";\nimport { PanelContext, useInfo } from \"../context\";\nimport PanelBody from \"../PanelBody\";\nimport PanelHeader from \"../PanelHeader\";\nexport default function MonthPanel(props) {\n var prefixCls = props.prefixCls,\n locale = props.locale,\n generateConfig = props.generateConfig,\n pickerValue = props.pickerValue,\n disabledDate = props.disabledDate,\n onPickerValueChange = props.onPickerValueChange,\n onModeChange = props.onModeChange;\n var panelPrefixCls = \"\".concat(prefixCls, \"-month-panel\");\n\n // ========================== Base ==========================\n var _useInfo = useInfo(props, 'month'),\n _useInfo2 = _slicedToArray(_useInfo, 1),\n info = _useInfo2[0];\n var baseDate = generateConfig.setMonth(pickerValue, 0);\n\n // ========================= Month ==========================\n var monthsLocale = locale.shortMonths || (generateConfig.locale.getShortMonths ? generateConfig.locale.getShortMonths(locale.locale) : []);\n\n // ========================= Cells ==========================\n var getCellDate = function getCellDate(date, offset) {\n return generateConfig.addMonth(date, offset);\n };\n var getCellText = function getCellText(date) {\n var month = generateConfig.getMonth(date);\n return locale.monthFormat ? formatValue(date, {\n locale: locale,\n format: locale.monthFormat,\n generateConfig: generateConfig\n }) : monthsLocale[month];\n };\n var getCellClassName = function getCellClassName() {\n return _defineProperty({}, \"\".concat(prefixCls, \"-cell-in-view\"), true);\n };\n\n // ======================== Disabled ========================\n var mergedDisabledDate = disabledDate ? function (currentDate, disabledInfo) {\n var startDate = generateConfig.setDate(currentDate, 1);\n var nextMonthStartDate = generateConfig.setMonth(startDate, generateConfig.getMonth(startDate) + 1);\n var endDate = generateConfig.addDate(nextMonthStartDate, -1);\n return disabledDate(startDate, disabledInfo) && disabledDate(endDate, disabledInfo);\n } : null;\n\n // ========================= Header =========================\n var yearNode = /*#__PURE__*/React.createElement(\"button\", {\n type: \"button\",\n key: \"year\",\n \"aria-label\": \"year panel\",\n onClick: function onClick() {\n onModeChange('year');\n },\n tabIndex: -1,\n className: \"\".concat(prefixCls, \"-year-btn\")\n }, formatValue(pickerValue, {\n locale: locale,\n format: locale.yearFormat,\n generateConfig: generateConfig\n }));\n\n // ========================= Render =========================\n return /*#__PURE__*/React.createElement(PanelContext.Provider, {\n value: info\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: panelPrefixCls\n }, /*#__PURE__*/React.createElement(PanelHeader, {\n superOffset: function superOffset(distance) {\n return generateConfig.addYear(pickerValue, distance);\n },\n onChange: onPickerValueChange\n // Limitation\n ,\n\n getStart: function getStart(date) {\n return generateConfig.setMonth(date, 0);\n },\n getEnd: function getEnd(date) {\n return generateConfig.setMonth(date, 11);\n }\n }, yearNode), /*#__PURE__*/React.createElement(PanelBody, _extends({}, props, {\n disabledDate: mergedDisabledDate,\n titleFormat: locale.fieldMonthFormat,\n colNum: 3,\n rowNum: 4,\n baseDate: baseDate\n // Body\n ,\n\n getCellDate: getCellDate,\n getCellText: getCellText,\n getCellClassName: getCellClassName\n }))));\n}","map":{"version":3,"names":["_extends","_defineProperty","_slicedToArray","React","formatValue","PanelContext","useInfo","PanelBody","PanelHeader","MonthPanel","props","prefixCls","locale","g