1 line
9.3 KiB
JSON
1 line
9.3 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 } from \"../../utils/dateUtil\";\nimport { PanelContext, useInfo } from \"../context\";\nimport PanelBody from \"../PanelBody\";\nimport PanelHeader from \"../PanelHeader\";\nexport default function QuarterPanel(props) {\n var prefixCls = props.prefixCls,\n locale = props.locale,\n generateConfig = props.generateConfig,\n pickerValue = props.pickerValue,\n onPickerValueChange = props.onPickerValueChange,\n onModeChange = props.onModeChange;\n var panelPrefixCls = \"\".concat(prefixCls, \"-quarter-panel\");\n\n // ========================== Base ==========================\n var _useInfo = useInfo(props, 'quarter'),\n _useInfo2 = _slicedToArray(_useInfo, 1),\n info = _useInfo2[0];\n var baseDate = generateConfig.setMonth(pickerValue, 0);\n\n // ========================= Cells ==========================\n var getCellDate = function getCellDate(date, offset) {\n return generateConfig.addMonth(date, offset * 3);\n };\n var getCellText = function getCellText(date) {\n return formatValue(date, {\n locale: locale,\n format: locale.cellQuarterFormat,\n generateConfig: generateConfig\n });\n };\n var getCellClassName = function getCellClassName() {\n return _defineProperty({}, \"\".concat(prefixCls, \"-cell-in-view\"), true);\n };\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 titleFormat: locale.fieldQuarterFormat,\n colNum: 4,\n rowNum: 1,\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","QuarterPanel","props","prefixCls","locale","generateConfig","pickerValue","onPickerValueChange","onModeChange","panelPrefixCls","concat","_useInfo","_useInfo2","info","baseDate","setMonth","getCellDate","date","offset","addMonth","getCellText","format","cellQuarterFormat","getCellClassName","yearNode","createElement","type","key","onClick","tabIndex","className","yearFormat","Provider","value","superOffset","distance","addYear","onChange","getStart","getEnd","titleFormat","fieldQuarterFormat","colNum","rowNum"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-picker/es/PickerPanel/QuarterPanel/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'
|