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';\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 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 getCellDate: getCellDate,\n getCellText: getCellText,\n getCellClassName: getCellClassName\n }))));\n}"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAOC,eAAe,MAAM,2CAA2C;AACvE,OAAOC,cAAc,MAAM,0CAA0C;AACrE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,SAASC,WAAW,QAAQ,sBAAsB;AAClD,SAASC,YAAY,EAAEC,OAA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