import { a as _inherits, b as _classCallCheck, c as _possibleConstructorReturn, d as _getPrototypeOf, e as _createClass } from '../inherits-6cb67931.js'; import React, { Component } from 'react'; import 'react-dom'; import Modal from '../Modal/index.js'; import { s as styleInject } from '../style-inject.es-1f59c1d0.js'; import '../defineProperty-18999f8e.js'; import '../_commonjsHelpers-97e6d7b1.js'; import '../index-c9837619.js'; import 'antd'; import WantedPublishView from '../WantedPublishView/index.js'; var css = ".WantedPublishModal_modalBg__3OlNh {\n background: white;\n display: flex;\n justify-content: center;\n flex-direction: column;\n align-items: center;\n padding: 16px;\n text-align: center;\n border-radius: 4px;\n}\n"; var styles = { "modalBg": "WantedPublishModal_modalBg__3OlNh" }; styleInject(css); var WantedPublishModal = /*#__PURE__*/ function (_Component) { _inherits(WantedPublishModal, _Component); function WantedPublishModal(props) { var _this; _classCallCheck(this, WantedPublishModal); _this = _possibleConstructorReturn(this, _getPrototypeOf(WantedPublishModal).call(this, props)); _this.handleModalShow = function () {}; _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({ modalVisible: false }); }; _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.clearCurrentWanted = function (cb) { _this.setState({ current_wanted: null }, function () { return cb(); }); }; _this.state = { modalVisible: false, current_wanted: null }; return _this; } _createClass(WantedPublishModal, [{ key: "renderMain", value: function renderMain() { var _this2 = this; var current_wanted = this.state.current_wanted; return React.createElement(WantedPublishView, { wrapperClass: styles.modalBg, 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; return React.createElement(React.Fragment, null, React.createElement("div", { onClick: function onClick() { return _this3.setState({ modalVisible: true }); } }, this.props.children), React.createElement(Modal, Object.assign({ visible: this.state.modalVisible, onCancel: this.handleClose }, this.props.modalConfig), this.renderMain())); } }]); return WantedPublishModal; }(Component); export default WantedPublishModal; export { WantedPublishModal }; //# sourceMappingURL=index.js.map