1 line
9.2 KiB
JSON
1 line
9.2 KiB
JSON
|
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nimport PickerPanel from \"../../PickerPanel\";\nimport { PickerHackContext } from \"../../PickerPanel/context\";\nimport PickerContext from \"../context\";\nimport { offsetPanelDate } from \"../hooks/useRangePickerValue\";\nexport default function PopupPanel(props) {\n var picker = props.picker,\n multiplePanel = props.multiplePanel,\n pickerValue = props.pickerValue,\n onPickerValueChange = props.onPickerValueChange,\n needConfirm = props.needConfirm,\n onSubmit = props.onSubmit,\n range = props.range,\n hoverValue = props.hoverValue;\n var _React$useContext = React.useContext(PickerContext),\n prefixCls = _React$useContext.prefixCls,\n generateConfig = _React$useContext.generateConfig;\n\n // ======================== Offset ========================\n var internalOffsetDate = React.useCallback(function (date, offset) {\n return offsetPanelDate(generateConfig, picker, date, offset);\n }, [generateConfig, picker]);\n var nextPickerValue = React.useMemo(function () {\n return internalOffsetDate(pickerValue, 1);\n }, [pickerValue, internalOffsetDate]);\n\n // Outside\n var onSecondPickerValueChange = function onSecondPickerValueChange(nextDate) {\n onPickerValueChange(internalOffsetDate(nextDate, -1));\n };\n\n // ======================= Context ========================\n var sharedContext = {\n onCellDblClick: function onCellDblClick() {\n if (needConfirm) {\n onSubmit();\n }\n }\n };\n var hideHeader = picker === 'time';\n\n // ======================== Props =========================\n var pickerProps = _objectSpread(_objectSpread({}, props), {}, {\n hoverValue: null,\n hoverRangeValue: null,\n hideHeader: hideHeader\n });\n if (range) {\n pickerProps.hoverRangeValue = hoverValue;\n } else {\n pickerProps.hoverValue = hoverValue;\n }\n\n // ======================== Render ========================\n // Multiple\n if (multiplePanel) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: \"\".concat(prefixCls, \"-panels\")\n }, /*#__PURE__*/React.createElement(PickerHackContext.Provider, {\n value: _objectSpread(_objectSpread({}, sharedContext), {}, {\n hideNext: true\n })\n }, /*#__PURE__*/React.createElement(PickerPanel, pickerProps)), /*#__PURE__*/React.createElement(PickerHackContext.Provider, {\n value: _objectSpread(_objectSpread({}, sharedContext), {}, {\n hidePrev: true\n })\n }, /*#__PURE__*/React.createElement(PickerPanel, _extends({}, pickerProps, {\n pickerValue: nextPickerValue,\n onPickerValueChange: onSecondPickerValueChange\n }))));\n }\n\n // Single\n return /*#__PURE__*/React.createElement(PickerHackContext.Provider, {\n value: _objectSpread({}, sharedContext)\n }, /*#__PURE__*/React.createElement(PickerPanel, pickerProps));\n}","map":{"version":3,"names":["_extends","_objectSpread","React","PickerPanel","PickerHackContext","PickerContext","offsetPanelDate","PopupPanel","props","picker","multiplePanel","pickerValue","onPickerValueChange","needConfirm","onSubmit","range","hoverValue","_React$useContext","useContext","prefixCls","generateConfig","internalOffsetDate","useCallback","date","offset","nextPickerValue","useMemo","onSecondPickerValueChange","nextDate","sharedContext","onCellDblClick","hideHeader","pickerProps","hoverRangeValue","createElement","className","concat","Provider","value","hideNext","hidePrev"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-picker/es/PickerInput/Popup/PopupPanel.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport * as React from 'react';\nimport PickerPanel from \"../../PickerPanel\";\nimport { PickerHackContext } from \"../../PickerPanel/context\";\nimport PickerContext from \
|