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/Аришина)/source/repos/PromoCursed/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 \"../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}"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAOC,aAAa,MAAM,0CAA0C;AACpE,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,WAAW,MAAM,mBAAmB;AAC3C,SAASC,iBAAiB,QAAQ,2BAA2B;AAC7D,OAAOC,aAAa,MAAM,YAAY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