"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); function _interopDefault(ex) { return ex && typeof ex === "object" && "default" in ex ? ex["default"] : ex; } var inherits = require("../inherits-c86d64c1.js"); var React = require("react"); var React__default = _interopDefault(React); require("react-dom"); var Modal = require("../Modal/index.js"); var styleInject_es = require("../style-inject.es-dcee06b6.js"); require("../defineProperty-ba7cd53d.js"); require("../_commonjsHelpers-72d386ba.js"); require("../index-44e17595.js"); require("antd"); var WantedPublishView = require("../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_es.styleInject(css); var WantedPublishModal = /*#__PURE__*/ (function(_Component) { inherits._inherits(WantedPublishModal, _Component); function WantedPublishModal(props) { var _this; inherits._classCallCheck(this, WantedPublishModal); _this = inherits._possibleConstructorReturn( this, inherits._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; } inherits._createClass(WantedPublishModal, [ { key: "renderMain", value: function renderMain() { var _this2 = this; var current_wanted = this.state.current_wanted; return React__default.createElement(WantedPublishView.default, { 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__default.createElement( React__default.Fragment, null, React__default.createElement( "div", { onClick: function onClick() { return _this3.setState({ modalVisible: true }); } }, this.props.children ), React__default.createElement( Modal.default, { visible: this.state.modalVisible, onCancel: this.handleClose }, this.renderMain() ) ); } } ]); return WantedPublishModal; })(React.Component); exports.WantedPublishModal = WantedPublishModal; exports.default = WantedPublishModal; //# sourceMappingURL=index.js.map