import { a as _inherits, b as _classCallCheck, c as _possibleConstructorReturn, d as _getPrototypeOf, e as _createClass } from '../inherits-6cb67931.js'; import React from 'react'; import { s as styleInject } from '../style-inject.es-1f59c1d0.js'; import '../defineProperty-18999f8e.js'; import '../_commonjsHelpers-97e6d7b1.js'; import '../index-c9837619.js'; import { Popover } from 'antd'; import WantedPublishView from '../WantedPublishView/index.js'; var img = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAFNElEQVRYR82Yf0jcdRjH33enp1NbTQ3FdKhTY64hTTsURc6keQeSqIPSQJIiMHM3zj8ST/BE/And+c8wmSSMomHl4EaaP2aeuq/R1MwrraEgLVbLXcvpReY847l9v3I7774/LKUHjuN79/k8z+v7+fG8n89Hhv+pyf4F1xEAxwE8BSAIQDAAPwB/AnCwnzsAVgHsSI0jFcwfwEkA8QAiRAYj0BUACwDsIvtALJgcwLMA0tjREevfs90tADcBbAg5EAN2FEAegFAhZyL/3wYwBeB7vvZCYFEAzgIIEBlUSjMCYwA4vXXiA6N1lAuApvGg7DaAL7zB+QILB1DA7rKDguL80shNegbxBkZbv4jd/gcNxfmfYHftbjxvYDR9CYdFxMahDfExm/tcP3mC0RQWHzIUF+5HAGPcgydYPoBn+MCSk5ODm5ubs4qKigadTq8b6rHuFRUVcYmJicf0ev2swAuTOnwC4L7niD0J4FW+zvHx8YEMw+gjIiKOz8zM3MjIyPhwa2vLp9xUV1cntra2VioUCv+WlpYug8EwLwD3HYAbnmApANL5OlZVVZ0wm806hUKhpHbz8/Nfq1Sqns3NzT1wdXV1J41GYwXXdnZ2lklNTb0sAEaK8JEnGKWHSKH1xY2Cn59fILVdXFz8RqVSXdrY2Nid16amptM1NTVvyeVy0laIGV23uJ+SpnJrTAHgTSEo7v/Kyso4k8l0XqlUUoWBpaUlW3p6epfdbn9oMpnO6HS6N+RyOfnE1NTUWFZW1hUx65H1T3I1z4E9AaBULBi1Ky8vj+ns7NQFBASE0PPKysqi1WqdKSsrK5XJZC61sFqtw2q1+jMpfgmK3ocDoymkqZRkJSUlUd3d3ReCgoJI6B+zwcHBzzUazTVJDh81XgJwnQOLY8Vasp+CgoKI3t7ed5VKJSmGy4aGhvrz8vIskp096kDF5TUOjCpR7X4c9fX1nS0sLCQJ27XV1dXbubm5HTabjSpZqfYTgAEOLAzAOake+vv787VaLSVlsh2Hw/EgODiY8iHsdvsdjUbTMT09/UCi3x9oeXJgtLvKpDgYHR0tzMnJoQISOzs7zq6urss9PT0LAwMDF0JDQ6mOw9ra2t38/Hzz5OTkHxJ8k0Lc5MDo+3UArsTJZ3K5HOPj469kZmbmsFDbHR0dH+j1+hl6TklJCRkZGdGFh4fH0PP6+vq94uJi8/DwsNh6/0sAt9y18kUAiXxQ/v7+MoZhXktLS8uidk6n82FbW9ul2trab937JSUlBVmt1vORkZGx9LvD4bhfWlpqtlgsvwm8NykIqcNf7mBUsb7E19FoNJ6qr6+vojbb29t/NzY2vt/Q0ECnnz0WGxsbODEx8U50dLSrhFpeXrYlJCRcFAD7BYBrN7uDkXzQOqOzoU+zWCwarVarNRgMF9vb2+nU49OioqKUDMO8HRIScjQ7O/u9hYUFoV1KZwCbJxg9vwDgjNA6U6vVx8bGxlzliZCFhYX5xcTEHJmbm1sXaEvnzysAtryB0eIvAeAS6EO2caoJuJjeSutTAFyL+xDtdwCkqbsViq9T0mHW/ZsArlLacx8IX2C0AV4G8PQBjxqlh34AP3vG4TvwkihrDhCOTkZ0+KBqYo8JXRHQyKkBnPiPR4524CAAnwlXCIzjOc3e9AhKlogXoCspOnnz5jSxYBSPLlaeB/AcAFfZLNHuAvgKwK9i+kkB4/xRjqP6jXSQhJpPKUi4aYToc08MEF8ek9KfRo675qRv7qqTu+6kVLAv28+I7SuQ1E7/AHTQdDZ7M6+KAAAAAElFTkSuQmCC"; var css = ".WantedPublishPopover_wantedWrapper__3CrCz {\n width: 366px;\n height: 424px;\n font-size: 18px;\n text-align: center;\n}\n.WantedPublishPopover_wantedWrapper__3CrCz .WantedPublishPopover_closeBtnWrapper__1KV58 {\n position: absolute;\n top: 10px;\n right: 16px;\n width: 20px;\n height: 20px;\n}\n.WantedPublishPopover_wantedWrapper__3CrCz .WantedPublishPopover_closeBtnWrapper__1KV58:focus {\n outline: none;\n}\n.WantedPublishPopover_wantedWrapper__3CrCz .WantedPublishPopover_closeBtnWrapper__1KV58 > div.WantedPublishPopover_closeBtn__1aBMB {\n border: none;\n padding: 0px;\n margin: 0px;\n cursor: pointer;\n}\n.WantedPublishPopover_wantedWrapper__3CrCz .WantedPublishPopover_closeBtnWrapper__1KV58 > div.WantedPublishPopover_closeBtn__1aBMB > img {\n width: 100%;\n}\n"; var styles = { "wantedWrapper": "WantedPublishPopover_wantedWrapper__3CrCz", "closeBtnWrapper": "WantedPublishPopover_closeBtnWrapper__1KV58", "closeBtn": "WantedPublishPopover_closeBtn__1aBMB" }; styleInject(css); var WantedPublishPopover = /*#__PURE__*/ function (_React$Component) { _inherits(WantedPublishPopover, _React$Component); function WantedPublishPopover(props) { var _this; _classCallCheck(this, WantedPublishPopover); _this = _possibleConstructorReturn(this, _getPrototypeOf(WantedPublishPopover).call(this, props)); _this.handleClose = function () { var handleConfirm = _this.props.handleConfirm; if (handleConfirm) { _this.handleUpdateCurrentWanted(_this.state.current_wanted, function (value) { handleConfirm(Number(value).toFixed(2)); }); } _this.setState({ visible: false }); }; _this.clearCurrentWanted = function (cb) { _this.setState({ current_wanted: null }, function () { return cb(); }); }; _this.handleUpdateCurrentWanted = function (value, afterUpdate) { if (!value) return; var result; result = value; if (parseInt("".concat(value), 10) === value) { result = Number(value); } if (!result) return; if (result > 10000) result = 10000; if (result < 5) result = 5; _this.setState({ current_wanted: result }, function () { return afterUpdate && afterUpdate(result); }); }; _this.state = { visible: false, current_wanted: null }; return _this; } _createClass(WantedPublishPopover, [{ key: "renderInitView", value: function renderInitView() { var _this2 = this; var current_wanted = this.state.current_wanted; return React.createElement(WantedPublishView, { type: "pop", current_wanted: current_wanted, InputWantedValueChange: function InputWantedValueChange(v) { return _this2.setState({ current_wanted: v }); }, InputWantedPressEnter: function InputWantedPressEnter(v) { return _this2.handleUpdateCurrentWanted(v, _this2.handleClose); }, InputWantedOnBlur: function InputWantedOnBlur(v) { return _this2.handleUpdateCurrentWanted(v); }, InputWantedClear: function InputWantedClear() { return _this2.clearCurrentWanted(_this2.handleClose); }, CloseFunction: this.handleClose }); } }, { key: "render", value: function render() { var _this3 = this; var _this$props = this.props, children = _this$props.children, _this$props$popoverCo = _this$props.popoverConfig, popoverConfig = _this$props$popoverCo === void 0 ? {} : _this$props$popoverCo; return React.createElement(Popover, Object.assign({ placement: "left", trigger: "click", visible: this.state.visible, onVisibleChange: function onVisibleChange(value) { if (!value) { _this3.handleClose(); } _this3.setState({ visible: value }); } }, popoverConfig, { content: React.createElement("div", { className: styles.wantedWrapper }, React.createElement("div", { role: "button", tabIndex: 1, className: styles.closeBtnWrapper }, React.createElement("div", { className: styles.closeBtn, onClick: this.handleClose }, React.createElement("img", { src: img, alt: "close wanted button" }))), this.renderInitView()) }), children); } }]); return WantedPublishPopover; }(React.Component); export default WantedPublishPopover; export { WantedPublishPopover }; //# sourceMappingURL=index.js.map