PromoCursed/node_modules/.cache/babel-loader/19cfd8a2ca42983a8aaf9ae7b8ec51c5c81678f87128e60da7fc4212da17d4ee.json

1 line
13 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, isInRange, isSameDecade } from \"../../utils/dateUtil\";\nimport { PanelContext, useInfo } from \"../context\";\nimport PanelBody from \"../PanelBody\";\nimport PanelHeader from \"../PanelHeader\";\nexport default function DecadePanel(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 var panelPrefixCls = \"\".concat(prefixCls, \"-decade-panel\");\n\n // ========================== Base ==========================\n var _useInfo = useInfo(props, 'decade'),\n _useInfo2 = _slicedToArray(_useInfo, 1),\n info = _useInfo2[0];\n var getStartYear = function getStartYear(date) {\n var startYear = Math.floor(generateConfig.getYear(pickerValue) / 100) * 100;\n return generateConfig.setYear(date, startYear);\n };\n var getEndYear = function getEndYear(date) {\n var startYear = getStartYear(date);\n return generateConfig.addYear(startYear, 99);\n };\n var startYearDate = getStartYear(pickerValue);\n var endYearDate = getEndYear(pickerValue);\n var baseDate = generateConfig.addYear(startYearDate, -10);\n\n // ========================= Cells ==========================\n var getCellDate = function getCellDate(date, offset) {\n return generateConfig.addYear(date, offset * 10);\n };\n var getCellText = function getCellText(date) {\n var cellYearFormat = locale.cellYearFormat;\n var startYearStr = formatValue(date, {\n locale: locale,\n format: cellYearFormat,\n generateConfig: generateConfig\n });\n var endYearStr = formatValue(generateConfig.addYear(date, 9), {\n locale: locale,\n format: cellYearFormat,\n generateConfig: generateConfig\n });\n return \"\".concat(startYearStr, \"-\").concat(endYearStr);\n };\n var getCellClassName = function getCellClassName(date) {\n return _defineProperty({}, \"\".concat(prefixCls, \"-cell-in-view\"), isSameDecade(generateConfig, date, startYearDate) || isSameDecade(generateConfig, date, endYearDate) || isInRange(generateConfig, startYearDate, endYearDate, date));\n };\n\n // ======================== Disabled ========================\n var mergedDisabledDate = disabledDate ? function (currentDate, disabledInfo) {\n // Start\n var baseStartDate = generateConfig.setDate(currentDate, 1);\n var baseStartMonth = generateConfig.setMonth(baseStartDate, 0);\n var baseStartYear = generateConfig.setYear(baseStartMonth, Math.floor(generateConfig.getYear(baseStartMonth) / 10) * 10);\n\n // End\n var baseEndYear = generateConfig.addYear(baseStartYear, 10);\n var baseEndDate = generateConfig.addDate(baseEndYear, -1);\n return disabledDate(baseStartYear, disabledInfo) && disabledDate(baseEndDate, disabledInfo);\n } : null;\n\n // ========================= Header =========================\n var yearNode = \"\".concat(formatValue(startYearDate, {\n locale: locale,\n format: locale.yearFormat,\n generateConfig: generateConfig\n }), \"-\").concat(formatValue(endYearDate, {\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 * 100);\n },\n onChange: onPickerValueChange\n // Limitation\n ,\n\n getStart: getStartYear,\n getEnd: getEndYear\n }, yearNode), /*#__PURE__*/R