1 line
13 KiB
JSON
1 line
13 KiB
JSON
{"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__*/React.createElement(PanelBody, _extends({}, props, {\n disabledDate: mergedDisabledDate,\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","isInRange","isSameDecade","PanelContext","useInfo","PanelBody","PanelHeader","DecadePanel","props","prefixCls","locale","generateConfig","pickerValue","disabledDate","onPickerValueChange","panelPrefixCls","concat","_useInfo","_useInfo2","info","getStartYear","date","startYear","Math","floor","getYear","setYear","getEndYear","addYear","startYearDate","endYearDate","baseDate","getCellDate","offset","getCellText","cellYearFormat","startYearStr","format","endYearStr","getCellClassName","mergedDisabledDate","currentDate","disabledInfo","baseStartDate","setDate","baseStartMonth","setMonth","baseStartYear","baseEndYear","baseEndDate","addDate","yearNode","yearFormat","createElement","Provider","value","className","superOffset","distance","onChange","getStart","getEnd","colNum","rowNum"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-picker/es/PickerPanel/DecadePanel/index.js"],"sourcesContent":["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 getStart: getStartYear,\n getEnd: getEndYear\n }, yearNode), /*#__PURE__*/React.createElement(PanelBody, _extends({}, props, {\n disabledDate: mergedDisabledDate,\n colNum: 3,\n rowNum: 4,\n baseDate: baseDate\n // Body\n ,\n getCellDate: getCellDate,\n getCellText: getCellText,\n getCellClassName: getCellClassName\n }))));\n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