暂无描述

index.js 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. import { a as _inherits, b as _classCallCheck, c as _possibleConstructorReturn, d as _getPrototypeOf, e as _createClass } from '../inherits-6cb67931.js';
  2. import React from 'react';
  3. import 'react-dom';
  4. import Modal from '../Modal/index.js';
  5. import { s as styleInject } from '../style-inject.es-1f59c1d0.js';
  6. import '../defineProperty-18999f8e.js';
  7. import '../index-e3cf212a.js';
  8. import 'antd';
  9. import WantedPublishView from '../WantedPublishView/index.js';
  10. import { W as WatnedPublishBase } from '../WantedPublish-b91e67a7.js';
  11. 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";
  12. var styles = {
  13. "modalBg": "WantedPublishModal_modalBg__3OlNh"
  14. };
  15. styleInject(css);
  16. var WantedPublishModal =
  17. /*#__PURE__*/
  18. function (_WatnedPublishBase) {
  19. _inherits(WantedPublishModal, _WatnedPublishBase);
  20. function WantedPublishModal(props) {
  21. var _this;
  22. _classCallCheck(this, WantedPublishModal);
  23. _this = _possibleConstructorReturn(this, _getPrototypeOf(WantedPublishModal).call(this, props));
  24. _this.handleConfirmButton = function (containerRef) {
  25. var handleConfirm = _this.props.handleConfirm;
  26. if (handleConfirm) {
  27. var value = _this.formatCurrentWanted(_this.state.current_wanted);
  28. handleConfirm(value ? Number(value).toFixed(2) : value);
  29. }
  30. _this.setState({
  31. modalVisible: false
  32. });
  33. };
  34. _this.state = {
  35. modalVisible: false,
  36. current_wanted: null
  37. };
  38. return _this;
  39. }
  40. _createClass(WantedPublishModal, [{
  41. key: "renderMain",
  42. value: function renderMain() {
  43. var _this2 = this;
  44. var current_wanted = this.state.current_wanted;
  45. return React.createElement(WantedPublishView, Object.assign({
  46. wrapperClass: styles.modalBg,
  47. current_wanted: current_wanted,
  48. InputWantedValueChange: function InputWantedValueChange(v) {
  49. return _this2.setState({
  50. current_wanted: v
  51. });
  52. },
  53. InputWantedPressEnter: function InputWantedPressEnter(v) {
  54. var value = _this2.formatCurrentWanted(v);
  55. if (_this2.props.handleConfirm) _this2.props.handleConfirm(_this2.formatResult(value));
  56. _this2.setState({
  57. current_wanted: value,
  58. modalVisible: false
  59. });
  60. },
  61. InputWantedOnBlur: function InputWantedOnBlur(v) {
  62. var value = _this2.formatCurrentWanted(v);
  63. _this2.setState({
  64. current_wanted: value
  65. });
  66. },
  67. InputWantedClear: function InputWantedClear() {
  68. _this2.setState({
  69. current_wanted: null
  70. }, function () {
  71. if (_this2.props.handleConfirm) _this2.props.handleConfirm(null);
  72. _this2.setState({
  73. modalVisible: false
  74. });
  75. });
  76. },
  77. InputWantedConfirm: this.handleConfirmButton
  78. }, this.props.viewConfig));
  79. }
  80. }, {
  81. key: "render",
  82. value: function render() {
  83. var _this3 = this;
  84. return React.createElement(React.Fragment, null, React.createElement("div", {
  85. onClick: function onClick() {
  86. return _this3.setState({
  87. modalVisible: true
  88. });
  89. }
  90. }, this.props.children), React.createElement(Modal, Object.assign({
  91. visible: this.state.modalVisible,
  92. onCancel: function onCancel() {
  93. _this3.setState({
  94. modalVisible: false
  95. });
  96. }
  97. }, this.props.modalConfig), this.renderMain()));
  98. }
  99. }]);
  100. return WantedPublishModal;
  101. }(WatnedPublishBase);
  102. export default WantedPublishModal;
  103. export { WantedPublishModal };
  104. //# sourceMappingURL=index.js.map